Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix flaky test case #376

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;

import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.get.GetResponse;
Expand Down Expand Up @@ -142,12 +143,13 @@ public void testHistoricalDetectorExceedsMaxRunningTaskLimit() throws IOExceptio
updateTransientSettings(ImmutableMap.of(MAX_BATCH_TASK_PER_NODE.getKey(), 1));
updateTransientSettings(ImmutableMap.of(BATCH_TASK_PIECE_INTERVAL_SECONDS.getKey(), 5));
DetectionDateRange dateRange = new DetectionDateRange(startTime, endTime);
for (int i = 0; i < getDataNodes().size(); i++) {
client().execute(ADBatchAnomalyResultAction.INSTANCE, adBatchAnomalyResultRequest(dateRange));
int totalDataNodes = getDataNodes().size();
for (int i = 0; i < totalDataNodes; i++) {
client().execute(ADBatchAnomalyResultAction.INSTANCE, adBatchAnomalyResultRequest(dateRange)).actionGet(5000);
}
waitUntil(() -> countDocs(CommonName.DETECTION_STATE_INDEX) >= totalDataNodes, 10, TimeUnit.SECONDS);

ADBatchAnomalyResultRequest request = adBatchAnomalyResultRequest(dateRange);

RuntimeException exception = expectThrowsAnyOf(
ImmutableList.of(LimitExceededException.class, NotSerializableExceptionWrapper.class),
() -> client().execute(ADBatchAnomalyResultAction.INSTANCE, request).actionGet(5000)
Expand Down