fixup! Add a test to cover Distributor pruning feature
The createBranch method used earlier doesn't create actual replication
task, fix it to create branch using GerritApi instead.
Change-Id: I9be784572d17521d329452f81fed224a69f9cddc
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDistributorIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDistributorIT.java
index 5ade68d..3d0dfc1 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDistributorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationDistributorIT.java
@@ -19,6 +19,7 @@
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.acceptance.WaitUtil;
+import com.google.gerrit.entities.BranchNameKey;
import com.google.gerrit.entities.Project;
import com.google.gerrit.server.git.WorkQueue;
import java.time.Duration;
@@ -89,8 +90,9 @@
reloadConfig();
String newBranch = "refs/heads/foo_branch";
- createBranch(project, "refs/heads/master", newBranch);
+ createBranch(BranchNameKey.create(project, newBranch));
+ assertThat(listWaitingReplicationTasks(newBranch)).hasSize(1);
deleteWaitingReplicationTasks(newBranch); // This simulates the work being started by other node
assertThat(waitForProjectTaskCount(0, Duration.ofSeconds(TEST_DISTRIBUTION_CYCLE_SECONDS)))