From 9078c0b2444748bf49b0df960284ec9767a758c4 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sun, 23 Jul 2017 21:20:18 +0200 Subject: [PATCH] [TEST] use true unique transport address in test to prevent address collision Original commit: elastic/x-pack-elasticsearch@91e5e1c0467a4823a55180fefe2e5e81cd4dbffe --- .../security/action/filter/SecurityActionFilterTests.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/security/action/filter/SecurityActionFilterTests.java b/plugin/src/test/java/org/elasticsearch/xpack/security/action/filter/SecurityActionFilterTests.java index a8563fcc3e7..093604948ca 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/security/action/filter/SecurityActionFilterTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/security/action/filter/SecurityActionFilterTests.java @@ -22,7 +22,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.tasks.Task; @@ -77,10 +76,8 @@ public class SecurityActionFilterTests extends ESTestCase { new ClusterSettings(settings, Collections.singleton(DestructiveOperations.REQUIRES_NAME_SETTING))); ClusterState state = mock(ClusterState.class); DiscoveryNodes nodes = DiscoveryNodes.builder() - .add(new DiscoveryNode("id1", - new TransportAddress(TransportAddress.META_ADDRESS, randomIntBetween(49000, 65500)), Version.CURRENT)) - .add(new DiscoveryNode("id2", - new TransportAddress(TransportAddress.META_ADDRESS, randomIntBetween(49000, 65500)), Version.V_5_4_0)) + .add(new DiscoveryNode("id1", buildNewFakeTransportAddress(), Version.CURRENT)) + .add(new DiscoveryNode("id2", buildNewFakeTransportAddress(), Version.V_5_4_0)) .build(); when(state.nodes()).thenReturn(nodes);