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
This commit is contained in:
@@ -762,7 +762,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user