@@ -268,7 +268,7 @@ public void testProxyStrategyWillResolveAddressesEachConnect() throws Exception
268268 }
269269 }
270270
271- public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange () {
271+ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesOrServerNameChange () {
272272 try (MockTransportService remoteTransport = startTransport ("node1" , Version .CURRENT )) {
273273 TransportAddress remoteAddress = remoteTransport .boundAddress ().publishAddress ();
274274
@@ -280,7 +280,7 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
280280 int numOfConnections = randomIntBetween (4 , 8 );
281281 try (RemoteConnectionManager remoteConnectionManager = new RemoteConnectionManager (clusterAlias , connectionManager );
282282 ProxyConnectionStrategy strategy = new ProxyConnectionStrategy (clusterAlias , localService , remoteConnectionManager ,
283- numOfConnections , remoteAddress .toString ())) {
283+ numOfConnections , remoteAddress .toString (), "server-name" )) {
284284 PlainActionFuture <Void > connectFuture = PlainActionFuture .newFuture ();
285285 strategy .connect (connectFuture );
286286 connectFuture .actionGet ();
@@ -295,11 +295,14 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
295295 .getConcreteSettingForNamespace ("cluster-alias" );
296296 Setting <?> socketConnections = ProxyConnectionStrategy .REMOTE_SOCKET_CONNECTIONS
297297 .getConcreteSettingForNamespace ("cluster-alias" );
298+ Setting <?> serverName = ProxyConnectionStrategy .SERVER_NAME
299+ .getConcreteSettingForNamespace ("cluster-alias" );
298300
299301 Settings noChange = Settings .builder ()
300302 .put (modeSetting .getKey (), "proxy" )
301303 .put (addressesSetting .getKey (), remoteAddress .toString ())
302304 .put (socketConnections .getKey (), numOfConnections )
305+ .put (serverName .getKey (), "server-name" )
303306 .build ();
304307 assertFalse (strategy .shouldRebuildConnection (noChange ));
305308 Settings addressesChanged = Settings .builder ()
@@ -313,6 +316,13 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
313316 .put (socketConnections .getKey (), numOfConnections + 1 )
314317 .build ();
315318 assertTrue (strategy .shouldRebuildConnection (socketsChanged ));
319+ Settings serverNameChange = Settings .builder ()
320+ .put (modeSetting .getKey (), "proxy" )
321+ .put (addressesSetting .getKey (), remoteAddress .toString ())
322+ .put (socketConnections .getKey (), numOfConnections )
323+ .put (serverName .getKey (), "server-name2" )
324+ .build ();
325+ assertTrue (strategy .shouldRebuildConnection (serverNameChange ));
316326 }
317327 }
318328 }
0 commit comments