ReplicationIT: speedup drain replication queue tests

Do not introduce artificial delays for the testing of the
replication queue drain.

Explicitly shutdown the replication config immediately
after the push operation, so that even a small 1s replication
delay is good enough to test the functionality.

Change-Id: I68caea21675875a947c2b520d265446ca2f7fe30
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 9b83b62..3554700 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java
@@ -245,15 +245,8 @@
     String remoteName = "doNotDrainQueue";
     setReplicationDestination(remoteName, "replica", ALL_PROJECTS);
 
-    // Setup long replication delay
-    int REPLICATION_DELAY = 3;
-    config.setInt("remote", remoteName, "replicationDelay", REPLICATION_DELAY);
-    config.setInt("remote", remoteName, "timeout", REPLICATION_DELAY * 2);
-    config.save();
-    reloadConfig();
-
     Result pushResult = createChange();
-    reloadConfig();
+    shutdownConfig();
 
     pushResult.getCommit();
     String sourceRef = pushResult.getPatchSet().getRefName();
@@ -271,18 +264,12 @@
     String remoteName = "drainQueue";
     setReplicationDestination(remoteName, "replica", ALL_PROJECTS);
 
-    // Setup long replication delay and draining policy
-    int REPLICATION_DELAY = 3;
-    int DRAIN_QUEUE_ATTEMPTS = 5;
-    config.setInt("remote", remoteName, "drainQueueAttempts", DRAIN_QUEUE_ATTEMPTS);
-    config.setInt("remote", remoteName, "replicationDelay", REPLICATION_DELAY);
-    // Make sure timeout is longer than the time needed to drain the queue
-    config.setInt("remote", remoteName, "timeout", REPLICATION_DELAY * DRAIN_QUEUE_ATTEMPTS * 2);
+    config.setInt("remote", remoteName, "drainQueueAttempts", 2);
     config.save();
     reloadConfig();
 
     Result pushResult = createChange();
-    reloadConfig();
+    shutdownConfig();
 
     RevCommit sourceCommit = pushResult.getCommit();
     String sourceRef = pushResult.getPatchSet().getRefName();
@@ -335,6 +322,10 @@
     plugin.getSysInjector().getInstance(AutoReloadConfigDecorator.class).forceReload();
   }
 
+  private void shutdownConfig() {
+    plugin.getSysInjector().getInstance(AutoReloadConfigDecorator.class).shutdown();
+  }
+
   private List<ReplicateRefUpdate> listReplicationTasks(String refRegex) {
     Pattern refmaskPattern = Pattern.compile(refRegex);
     return tasksStorage.list().stream()