Fix FanoutConfigurationResource update API

When updating the FanoutConfigurationResource, the remote subsection
needs to be removed as the subsection name is part of the config
filename.

Bug: Issue 351843807
Change-Id: Ib434a434a82de7e237387c7d7df8eb0e78cfa5a6
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResource.java b/src/main/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResource.java
index 1ecf242..c634cce 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResource.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResource.java
@@ -101,7 +101,7 @@
       Set<String> options = updates.getNames("remote", remote);
       for (String option : options) {
         List<String> values = List.of(updates.getStringList("remote", remote, option));
-        remoteConfig.setStringList("remote", remote, option, values);
+        remoteConfig.setStringList("remote", null, option, values);
         config.setStringList("remote", remote, option, values);
       }
       remoteConfig.save();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResourceTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResourceTest.java
index c91ac14..a3d811f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResourceTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/FanoutConfigResourceTest.java
@@ -324,7 +324,7 @@
     assertThat(objectUnderTest.getConfig().getString("remote", remoteName1, "url"))
         .isEqualTo(remoteUrl1);
     Config actual = loadRemoteConfig(remoteName1);
-    assertThat(actual.getString("remote", remoteName1, "url")).isEqualTo(remoteUrl1);
+    assertThat(actual.getString("remote", null, "url")).isEqualTo(remoteUrl1);
   }
 
   @Test
@@ -341,7 +341,7 @@
     assertThat(objectUnderTest.getConfig().getString("remote", remoteName1, "url"))
         .isEqualTo(remoteUrl2);
     Config actual = loadRemoteConfig(remoteName1);
-    assertThat(actual.getString("remote", remoteName1, "url")).isEqualTo(remoteUrl2);
+    assertThat(actual.getString("remote", null, "url")).isEqualTo(remoteUrl2);
   }
 
   protected FileBasedConfig newRemoteConfig(String configFileName) {