From 78506b9c7e4795c64bf2fa1b195a56be30d80648 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Thu, 29 Apr 2021 16:06:27 +0200 Subject: [PATCH] Fix SearchableSnapshotsLicenseIntegTests.testShardAllocationOnInvalidLicense --- .../SearchableSnapshotsLicenseIntegTests.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java index 767e0b1c4c646..bb8d1e74b52b9 100644 --- a/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java +++ b/x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotsLicenseIntegTests.java @@ -89,6 +89,9 @@ public void createAndMountSearchableSnapshot() throws Exception { assertAcked(client().execute(DeleteLicenseAction.INSTANCE, new DeleteLicenseRequest()).get()); assertAcked(client().execute(PostStartBasicAction.INSTANCE, new PostStartBasicRequest()).get()); + + ensureClusterSizeConsistency(); + ensureClusterStateConsistency(); } public void testMountRequiresLicense() { @@ -150,6 +153,10 @@ public void testShardAllocationOnInvalidLicense() throws Exception { client().admin().cluster().prepareHealth(indexName).get().getIndices().get(indexName).getStatus() ) ); + + waitNoPendingTasksOnAll(); + ensureClusterStateConsistency(); + // add a valid license again // This is a bit of a hack in tests, as we can't readd a trial license // We force this by clearing the existing basic license first @@ -158,6 +165,10 @@ public void testShardAllocationOnInvalidLicense() throws Exception { .metadata(Metadata.builder(currentState.metadata()).removeCustom(LicensesMetadata.TYPE).build()) .build() ); + + waitNoPendingTasksOnAll(); + ensureClusterStateConsistency(); + PostStartTrialRequest startTrialRequest = new PostStartTrialRequest().setType(License.LicenseType.TRIAL.getTypeName()) .acknowledge(true); PostStartTrialResponse resp = client().execute(PostStartTrialAction.INSTANCE, startTrialRequest).get();