Skip to content

Commit

Permalink
Fix SearchableSnapshotsLicenseIntegTests.testShardAllocationOnInvalid…
Browse files Browse the repository at this point in the history
…License (#72528) (#72611)

This test fails sometimes on CI (see #72329) when recreating the 
license. It's not clear to me why that happens but I suspect batched 
cluster state updates, so this pull request adds some waiting points 
in the test.

Backport of #72528
  • Loading branch information
tlrx authored May 3, 2021
1 parent 2fb17e5 commit ae04192
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit ae04192

Please sign in to comment.