@@ -268,7 +268,7 @@ public void testProxyStrategyWillResolveAddressesEachConnect() throws Exception
268
268
}
269
269
}
270
270
271
- public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange () {
271
+ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesOrServerNameChange () {
272
272
try (MockTransportService remoteTransport = startTransport ("node1" , Version .CURRENT )) {
273
273
TransportAddress remoteAddress = remoteTransport .boundAddress ().publishAddress ();
274
274
@@ -280,7 +280,7 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
280
280
int numOfConnections = randomIntBetween (4 , 8 );
281
281
try (RemoteConnectionManager remoteConnectionManager = new RemoteConnectionManager (clusterAlias , connectionManager );
282
282
ProxyConnectionStrategy strategy = new ProxyConnectionStrategy (clusterAlias , localService , remoteConnectionManager ,
283
- numOfConnections , remoteAddress .toString ())) {
283
+ numOfConnections , remoteAddress .toString (), "server-name" )) {
284
284
PlainActionFuture <Void > connectFuture = PlainActionFuture .newFuture ();
285
285
strategy .connect (connectFuture );
286
286
connectFuture .actionGet ();
@@ -295,11 +295,14 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
295
295
.getConcreteSettingForNamespace ("cluster-alias" );
296
296
Setting <?> socketConnections = ProxyConnectionStrategy .REMOTE_SOCKET_CONNECTIONS
297
297
.getConcreteSettingForNamespace ("cluster-alias" );
298
+ Setting <?> serverName = ProxyConnectionStrategy .SERVER_NAME
299
+ .getConcreteSettingForNamespace ("cluster-alias" );
298
300
299
301
Settings noChange = Settings .builder ()
300
302
.put (modeSetting .getKey (), "proxy" )
301
303
.put (addressesSetting .getKey (), remoteAddress .toString ())
302
304
.put (socketConnections .getKey (), numOfConnections )
305
+ .put (serverName .getKey (), "server-name" )
303
306
.build ();
304
307
assertFalse (strategy .shouldRebuildConnection (noChange ));
305
308
Settings addressesChanged = Settings .builder ()
@@ -313,6 +316,13 @@ public void testProxyStrategyWillNeedToBeRebuiltIfNumOfSocketsOrAddressesChange(
313
316
.put (socketConnections .getKey (), numOfConnections + 1 )
314
317
.build ();
315
318
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 ));
316
326
}
317
327
}
318
328
}
0 commit comments