Skip to content

Commit 31dc5b7

Browse files
committed
[TEST] Wait for replicas before stopping nodes in ML distributed test (elastic#43622)
If we stop a node before replicas exist then the test can fail because we lose a whole index if we stop the node with the primary on.
1 parent 58d0d5c commit 31dc5b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ public void testCloseUnassignedJobAndDatafeed() throws Exception {
146146
waitForDatafeed(jobId, numDocs1);
147147

148148
// stop the only ML node
149+
ensureGreen(); // replicas must be assigned, otherwise we could lose a whole index
149150
internalCluster().stopRandomNonMasterNode();
151+
ensureStableCluster(1);
150152

151153
// Job state is opened but the job is not assigned to a node (because we just killed the only ML node)
152154
GetJobsStatsAction.Request jobStatsRequest = new GetJobsStatsAction.Request(jobId);
@@ -198,7 +200,7 @@ public void testJobRelocationIsMemoryAware() throws Exception {
198200

199201
// Wait for the cluster to be green - this means the indices have been replicated.
200202

201-
ensureGreen(".ml-config", ".ml-anomalies-shared", ".ml-notifications");
203+
ensureGreen();
202204

203205
// Open a big job. This should go on a different node to the 4 small ones.
204206

0 commit comments

Comments
 (0)