Fix AbstractSubmit test flakiness
Due to a simple typo in [1], the test OnSubmitValidationListener
implementation was looking for the old value of master in "project",
which is the default repo created during AbstractDaemonTest setup. It
should be looking instead in the repo that the validator is currently
processing.
It's somewhat surprising that this bug resulted in flakiness rather than
outright failure: at first glance, it doesn't seem like project and
repoA/repoB should contain any of the same history, so how could the
value of master in project accidentally match the value of master in
repoA? It turns out that the empty commit created by CreateProject is
identical if the current timestamps are identical. Since the test repos
are all created immediately one after the other, there's actually a
pretty good chance that they end up with the same initial value of
master.
[1] https://gerrit-review.googlesource.com/c/100956
Change-Id: I38a545aa68c341610e5f9dc9654a4d4775cd2097
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
index 665d546..75e7663 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java
@@ -762,7 +762,7 @@
assertThat(args.getCommands()).containsKey(master);
ReceiveCommand cmd = args.getCommands().get(master);
ObjectId newMasterId = cmd.getNewId();
- try (Repository repo = repoManager.openRepository(project)) {
+ try (Repository repo = repoManager.openRepository(args.getProject())) {
assertThat(repo.exactRef(master).getObjectId()).isEqualTo(cmd.getOldId());
assertThat(args.getRef(master)).hasValue(newMasterId);
args.getRevWalk().parseBody(args.getRevWalk().parseCommit(newMasterId));