diff options
author | Luca Milanesio <luca.milanesio@gmail.com> | 2019-08-28 16:12:03 +0200 |
---|---|---|
committer | Luca Milanesio <luca.milanesio@gmail.com> | 2019-08-28 16:23:05 +0200 |
commit | ba9f04aece217d477e0ec3973aec3fd1b32bc6ab (patch) | |
tree | bc07f0d05892bc71e4b9084c305292f0a8649d1a | |
parent | 729e1df4b4dbc73bcf7f97dfdb55301343628ef3 (diff) |
ReplicationIT: fix flakiness of shouldReplicateNewBranch
shouldReplicateNewBranch() should compare the target branch with
the source SHA1 and not with the target.
Comparing two SHA1 on the target repository is flaky because
the two replication events may come at different times.
Change-Id: Icfc4da705bc07805e881faea517984fb2c9abe09
-rw-r--r-- | src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java index 1bb0bbf..471d729 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java @@ -143,11 +143,12 @@ public class ReplicationIT extends LightweightPluginDaemonTest { assertThat(listReplicationTasks("refs/heads/(mybranch|master)")).hasSize(2); - try (Repository repo = repoManager.openRepository(targetProject)) { + try (Repository repo = repoManager.openRepository(targetProject); + Repository sourceRepo = repoManager.openRepository(project)) { waitUntil(() -> checkedGetRef(repo, newBranch) != null); + Ref masterRef = getRef(sourceRepo, master); Ref targetBranchRef = getRef(repo, newBranch); - Ref masterRef = getRef(repo, master); assertThat(targetBranchRef).isNotNull(); assertThat(targetBranchRef.getObjectId()).isEqualTo(masterRef.getObjectId()); } |