PullReplicationIT: simplify fetching HTTP URL Get the HTTP URL from the adminRestSession, which includes also the automatic strip of the trailing slash. Change-Id: I1e0bc03c1f219ff4fad893c25e626ce64b41016e
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationIT.java index 53f7767..edea656 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/pull/PullReplicationIT.java
@@ -174,7 +174,7 @@ .collect(toList()); config.setString("replication", null, "instanceLabel", remoteName); config.setStringList("remote", remoteName, "url", replicaUrls); - config.setString("remote", remoteName, "apiUrl", getListenUrl()); + config.setString("remote", remoteName, "apiUrl", adminRestSession.url()); config.setString("remote", remoteName, "fetch", "+refs/*:refs/*"); config.setInt("remote", remoteName, "timeout", 600); config.setInt("remote", remoteName, "replicationDelay", TEST_REPLICATION_DELAY); @@ -201,12 +201,4 @@ private Project.NameKey createTestProject(String name) throws Exception { return projectOperations.newProject().name(name).create(); } - - private String getListenUrl() throws IOException, ConfigInvalidException { - FileBasedConfig gerritConfig = - new FileBasedConfig(sitePaths.etc_dir.resolve("gerrit.config").toFile(), FS.DETECTED); - gerritConfig.load(); - String listenUrl = gerritConfig.getString("httpd", null, "listenUrl"); - return listenUrl.endsWith("/") ? listenUrl.substring(0, listenUrl.length() - 1) : listenUrl; - } }