[TEST] use true unique transport address in test to prevent address collision

Original commit: elastic/x-pack-elasticsearch@91e5e1c046
This commit is contained in:
Simon Willnauer 2017-07-23 21:20:18 +02:00
parent 04ace4f1df
commit 9078c0b244
1 changed files with 2 additions and 5 deletions

View File

@ -22,7 +22,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
@ -77,10 +76,8 @@ public class SecurityActionFilterTests extends ESTestCase {
new ClusterSettings(settings, Collections.singleton(DestructiveOperations.REQUIRES_NAME_SETTING))); new ClusterSettings(settings, Collections.singleton(DestructiveOperations.REQUIRES_NAME_SETTING)));
ClusterState state = mock(ClusterState.class); ClusterState state = mock(ClusterState.class);
DiscoveryNodes nodes = DiscoveryNodes.builder() DiscoveryNodes nodes = DiscoveryNodes.builder()
.add(new DiscoveryNode("id1", .add(new DiscoveryNode("id1", buildNewFakeTransportAddress(), Version.CURRENT))
new TransportAddress(TransportAddress.META_ADDRESS, randomIntBetween(49000, 65500)), Version.CURRENT)) .add(new DiscoveryNode("id2", buildNewFakeTransportAddress(), Version.V_5_4_0))
.add(new DiscoveryNode("id2",
new TransportAddress(TransportAddress.META_ADDRESS, randomIntBetween(49000, 65500)), Version.V_5_4_0))
.build(); .build();
when(state.nodes()).thenReturn(nodes); when(state.nodes()).thenReturn(nodes);