From ba9f04aece217d477e0ec3973aec3fd1b32bc6ab Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 28 Aug 2019 16:12:03 +0200 Subject: 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 --- .../com/googlesource/gerrit/plugins/replication/ReplicationIT.java | 5 +++-- 1 file 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()); } -- cgit v1.2.3