diff options
Diffstat (limited to 'src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java')
-rw-r--r-- | src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java | 22 |
1 files changed, 22 insertions, 0 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 a174e91..33bd91d 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java @@ -348,6 +348,28 @@ public class ReplicationIT extends ReplicationDaemon { } } + @Test + public void shouldReplicateWithPushBatchSizeSetForRemote() throws Exception { + Project.NameKey targetProject = createTestProject(project + "replica"); + + setReplicationDestination("foo", "replica", ALL_PROJECTS, 1); + reloadConfig(); + + // creating a change results in 2 refs creation therefore it already qualifies for push in two + // batches of size 1 each + Result pushResult = createChange(); + RevCommit sourceCommit = pushResult.getCommit(); + String sourceRef = pushResult.getPatchSet().refName(); + + try (Repository repo = repoManager.openRepository(targetProject)) { + WaitUtil.waitUntil(() -> checkedGetRef(repo, sourceRef) != null, Duration.ofSeconds(60)); + + Ref targetBranchRef = getRef(repo, sourceRef); + assertThat(targetBranchRef).isNotNull(); + assertThat(targetBranchRef.getObjectId()).isEqualTo(sourceCommit.getId()); + } + } + private void waitUntil(Supplier<Boolean> waitCondition) throws InterruptedException { WaitUtil.waitUntil(waitCondition, TEST_TIMEOUT); } |