Fix failing AutoReloadConfigDecorator tests
Currently configuration is loaded in ReplicationFileBasedConfig
constructor instead of ConfigParser.parseRemotes method. Adjust
AutoReloadConfigDecorator tests to load initial state correctly.
Feature: Issue 12450
Change-Id: Iaa9163bd409c56789b1f190293c89b35d632a2a3
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/AutoReloadConfigDecoratorTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/AutoReloadConfigDecoratorTest.java
index 372540f..54a4d1c 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/AutoReloadConfigDecoratorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/AutoReloadConfigDecoratorTest.java
@@ -22,7 +22,6 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.junit.Before;
import org.junit.Test;
public class AutoReloadConfigDecoratorTest extends AbstractConfigTest {
@@ -32,14 +31,6 @@
super();
}
- @Override
- @Before
- public void setup() {
- super.setup();
-
- replicationFileBasedConfig = newReplicationFileBasedConfig();
- }
-
@Test
public void shouldAutoReloadReplicationConfig() throws Exception {
FileBasedConfig replicationConfig = newReplicationConfig();
@@ -49,6 +40,8 @@
replicationConfig.setString("remote", remoteName1, "url", remoteUrl1);
replicationConfig.save();
+ replicationFileBasedConfig = newReplicationFileBasedConfig();
+
newAutoReloadConfig().start();
DestinationsCollection destinationsCollections =
@@ -81,6 +74,8 @@
replicationConfig.setString("remote", remoteName1, "url", remoteUrl1);
replicationConfig.save();
+ replicationFileBasedConfig = newReplicationFileBasedConfig();
+
DestinationsCollection destinationsCollections =
newDestinationsCollections(replicationFileBasedConfig);
destinationsCollections.startup(workQueueMock);