Fix DanglingIndicesIT Failures from MasterNotDiscoveredException (#58215) (#58221)

The dangling indices action is not a proper master node action so it does not
retry when executed while the cluster hasn't fully formed yet.
Since we use node restarts when setting up the dangling indices state we need
to manually ensure a fully formed cluster before moving on with the tests to avoid
failures.
This commit is contained in:
Armin Braun 2020-06-17 10:34:08 +02:00 committed by GitHub
parent 7080ba5b05
commit c2b416ee31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -240,8 +240,7 @@ public class DanglingIndicesIT extends ESIntegTestCase {
final String danglingIndexUUID = findDanglingIndexForNode(stoppedNodeName, INDEX_NAME);
final ImportDanglingIndexRequest request = new ImportDanglingIndexRequest(danglingIndexUUID, true);
client().admin().cluster().importDanglingIndex(request).actionGet();
client().admin().cluster().importDanglingIndex(request).get();
assertTrue("Expected dangling index " + INDEX_NAME + " to be recovered", indexExists(INDEX_NAME));
}
@ -480,6 +479,7 @@ public class DanglingIndicesIT extends ESIntegTestCase {
AtomicReference<String> stoppedNodeName = new AtomicReference<>();
final int nodes = internalCluster().size();
// Restart node, deleting the indices in its absence, so that there is a dangling index to recover
internalCluster().restartRandomDataNode(new InternalTestCluster.RestartCallback() {
@ -493,6 +493,7 @@ public class DanglingIndicesIT extends ESIntegTestCase {
return super.onNodeStopped(nodeName);
}
});
ensureStableCluster(nodes);
return stoppedNodeName.get();
}