summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Hiesel <hiesel@google.com>2021-07-13 14:05:52 +0200
committerLuca Milanesio <luca.milanesio@gmail.com>2023-12-02 02:27:34 +0000
commit46bd79f917f39aad98fc25324d710b2665446a58 (patch)
tree704ae1cc691475e5acbaa9a471e88f8f26077696
parent17aa9fb80944d47eac74c39d3ab7a2cf39912740 (diff)
RefAdvertisementIT: Don't call reindex that would fail silently
receivePackOmitsMissingObject wants to test a scenario where we have a change ref, but the patch set ref / commit was deleted or is otherwise gone. It did that by adding a new patch set pointing to a non-existent SHA1 and triggered a reindex of that change. However, that reindex fails silently because we submit the reindex task to another executor and provide no feedback to the caller. This commit modifies the test and just deletes the patch set ref which makes for the same scenario but without the reindex trouble. This change is part of a series that allows for the fake change index to run in integration tests. The fake index throws an exception in case reindexing fails, which made this test fail. Release-Notes: skip Change-Id: Icf79795a343a6abca28c6504b279eb0a5c84fad2
-rw-r--r--javatests/com/google/gerrit/acceptance/git/RefAdvertisementIT.java33
1 files changed, 2 insertions, 31 deletions
diff --git a/javatests/com/google/gerrit/acceptance/git/RefAdvertisementIT.java b/javatests/com/google/gerrit/acceptance/git/RefAdvertisementIT.java
index 1083377b80..a96fbcfa7e 100644
--- a/javatests/com/google/gerrit/acceptance/git/RefAdvertisementIT.java
+++ b/javatests/com/google/gerrit/acceptance/git/RefAdvertisementIT.java
@@ -39,7 +39,6 @@ import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.entities.AccountGroup;
-import com.google.gerrit.entities.Change;
import com.google.gerrit.entities.Patch;
import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.entities.Project;
@@ -68,7 +67,6 @@ import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
@@ -1061,37 +1059,10 @@ public class RefAdvertisementIT extends AbstractDaemonTest {
@Test
public void receivePackOmitsMissingObject() throws Exception {
- String rev = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
try (Repository repo = repoManager.openRepository(project);
TestRepository<Repository> tr = new TestRepository<>(repo)) {
- String subject = "Subject for missing commit";
- Change c = new Change(cd3.change());
- PatchSet.Id psId = PatchSet.id(cd3.getId(), 2);
- c.setCurrentPatchSet(psId, subject, c.getOriginalSubject());
-
- PersonIdent committer = serverIdent.get();
- PersonIdent author =
- noteUtil.newIdent(getAccount(admin.id()).id(), committer.getWhen(), committer);
- tr.branch(RefNames.changeMetaRef(cd3.getId()))
- .commit()
- .author(author)
- .committer(committer)
- .message(
- "Update patch set "
- + psId.get()
- + "\n"
- + "\n"
- + "Patch-set: "
- + psId.get()
- + "\n"
- + "Commit: "
- + rev
- + "\n"
- + "Subject: "
- + subject
- + "\n")
- .create();
- indexer.index(c.getProject(), c.getId());
+ PatchSet.Id psId = PatchSet.id(cd3.getId(), 1);
+ tr.delete(psId.toRefName());
}
assertThat(getReceivePackRefs().additionalHaves()).containsExactly(obj(cd4, 1));