diff --git a/elasticsearch/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java b/elasticsearch/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java index 3352ca4b04f..391213273a0 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/license/LicenseServiceClusterTests.java @@ -21,12 +21,11 @@ import java.nio.file.Path; import java.util.Arrays; import java.util.Collection; -import static org.elasticsearch.license.TestUtils.generateSignedLicense; import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; -@ClusterScope(scope = TEST, numDataNodes = 0, numClientNodes = 0, maxNumDataNodes = 0, transportClientRatio = 0) +@ClusterScope(scope = TEST, numDataNodes = 0, numClientNodes = 0, maxNumDataNodes = 0, transportClientRatio = 0, autoMinMasterNodes = false) public class LicenseServiceClusterTests extends AbstractLicensesIntegrationTestCase { @Override diff --git a/elasticsearch/src/test/java/org/elasticsearch/license/TribeTransportTestCase.java b/elasticsearch/src/test/java/org/elasticsearch/license/TribeTransportTestCase.java index b285d1c8874..1267a1bad73 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/license/TribeTransportTestCase.java +++ b/elasticsearch/src/test/java/org/elasticsearch/license/TribeTransportTestCase.java @@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; -@ClusterScope(scope = Scope.TEST, transportClientRatio = 0, numClientNodes = 1, numDataNodes = 0) +@ClusterScope(scope = Scope.TEST, transportClientRatio = 0, numClientNodes = 1, numDataNodes = 2) public abstract class TribeTransportTestCase extends ESIntegTestCase { protected List enabledFeatures() { @@ -99,12 +99,11 @@ public abstract class TribeTransportTestCase extends ESIntegTestCase { } }; final InternalTestCluster cluster2 = new InternalTestCluster( - randomLong(), createTempDir(), true, 2, 2, + randomLong(), createTempDir(), true, true, 2, 2, UUIDs.randomBase64UUID(random()), nodeConfigurationSource, 1, false, "tribe_node2", getMockPlugins(), getClientWrapper()); cluster2.beforeTest(random(), 0.0); - cluster2.ensureAtLeastNumDataNodes(2); logger.info("create 2 indices, test1 on t1, and test2 on t2"); assertAcked(internalCluster().client().admin().indices().prepareCreate("test1").get()); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/resolver/node/MultiNodesStatsTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/resolver/node/MultiNodesStatsTests.java index 63bd91ebeb9..b413f20735c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/resolver/node/MultiNodesStatsTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/resolver/node/MultiNodesStatsTests.java @@ -69,8 +69,10 @@ public class MultiNodesStatsTests extends MonitoringIntegTestCase { n = randomIntBetween(1, 2); logger.debug("--> starting {} extra nodes", n); - InternalTestCluster.Async> extraNodes = internalCluster().startNodesAsync(n); - extraNodes.get(); + // starting one by one to allow moving , for example, from a 2 node cluster to a 4 one while updating min_master_nodes + for (int i=0;i { for (XPackLicenseState licenseState : internalCluster().getInstances(XPackLicenseState.class)) { assertThat(licenseState.isWatcherAllowed(), is(true)); @@ -595,6 +603,21 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase }); } + private void progressClocksAboveMaster(InternalTestCluster cluster) { + long minClock = Long.MAX_VALUE; + long maxClock = Long.MIN_VALUE; + for (Clock clock: cluster.getInstances(Clock.class)) { + final long millis = clock.millis(); + minClock = Math.min(millis, minClock); + maxClock = Math.max(millis, maxClock); + } + // now move all the clocks ahead to make sure they are beyond the highest clock + final TimeValue delta = TimeValue.timeValueMillis(maxClock - minClock); + for (Clock clock: cluster.getInstances(Clock.class)) { + ((ClockMock)clock).fastForward(delta); + } + } + protected void ensureWatcherStopped() throws Exception { ensureWatcherStopped(true); }