From 6c02cf0241eca437b34c2e12ea4ccf12d37d0ee0 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Fri, 12 Jul 2019 13:18:55 +0200 Subject: [PATCH] Fix InternalTestCluster StopRandomNode Assertion (#44258) (#44265) * The assertion added in #44214 is tripped by tests running dedicated test clusters per test needlessly.This breaks existing tests like the one in #44245. * Closes #44245 --- .../admin/indices/shards/IndicesShardStoreRequestIT.java | 1 - .../main/java/org/elasticsearch/test/InternalTestCluster.java | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoreRequestIT.java b/server/src/test/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoreRequestIT.java index 4dc1d4ff47a..80694a0a8b4 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoreRequestIT.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoreRequestIT.java @@ -71,7 +71,6 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase { assertThat(rsp.getStoreStatuses().size(), equalTo(0)); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/44245") public void testBasic() throws Exception { String index = "test"; internalCluster().ensureAtLeastNumDataNodes(2); diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index 00c837feb1b..bd3340dd6b0 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -1632,7 +1632,9 @@ public final class InternalTestCluster extends TestCluster { ensureOpen(); NodeAndClient nodeAndClient = getRandomNodeAndClient(nc -> filter.test(nc.node.settings())); if (nodeAndClient != null) { - if (nodeAndClient.nodeAndClientId() < sharedNodesSeeds.length && nodeAndClient.isMasterEligible() && autoManageMasterNodes + if (nodePrefix.equals(ESIntegTestCase.SUITE_CLUSTER_NODE_PREFIX) && nodeAndClient.nodeAndClientId() < sharedNodesSeeds.length + && nodeAndClient.isMasterEligible() + && autoManageMasterNodes && nodes.values().stream() .filter(NodeAndClient::isMasterEligible) .filter(n -> n.nodeAndClientId() < sharedNodesSeeds.length)