Skip to content

Commit 2382701

Browse files
committed
Wait for pending tasks in docs tests cleanup (#44123)
ML and Data Frame tests should wait for pending tasks
1 parent eb1106c commit 2382701

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

docs/reference/data-frames/apis/put-transform.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ PUT _data_frame/transforms/ecommerce_transform
110110
}
111111
--------------------------------------------------
112112
// CONSOLE
113-
// TEST[skip: https://github.com/elastic/elasticsearch/issues/43271]
113+
// TEST[setup:kibana_sample_data_ecommerce]
114114

115115
When the transform is created, you receive the following results:
116116
[source,js]

docs/reference/ml/apis/put-job.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ PUT _ml/anomaly_detectors/total-requests
120120
}
121121
--------------------------------------------------
122122
// CONSOLE
123-
// TEST[skip: https://github.com/elastic/elasticsearch/issues/43271]
124123

125124
When the job is created, you receive the following results:
126125
[source,js]

docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.elasticsearch.common.xcontent.XContentLocation;
3434
import org.elasticsearch.common.xcontent.XContentParser;
3535
import org.elasticsearch.common.xcontent.XContentParser.Token;
36+
import org.elasticsearch.test.rest.ESRestTestCase;
3637
import org.elasticsearch.test.rest.yaml.ClientYamlDocsTestClient;
3738
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
3839
import org.elasticsearch.test.rest.yaml.ClientYamlTestClient;
@@ -41,6 +42,7 @@
4142
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
4243
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec;
4344
import org.elasticsearch.test.rest.yaml.section.ExecutableSection;
45+
import org.junit.After;
4446

4547
import java.io.IOException;
4648
import java.util.ArrayList;
@@ -97,6 +99,23 @@ protected ClientYamlTestClient initClientYamlTestClient(
9799
return new ClientYamlDocsTestClient(restSpec, restClient, hosts, esVersion, masterVersion, this::getClientBuilderWithSniffedHosts);
98100
}
99101

102+
@After
103+
public void cleanup() throws Exception {
104+
if (isMachineLearningTest() || isDataFrameTest()) {
105+
ESRestTestCase.waitForPendingTasks(adminClient());
106+
}
107+
}
108+
109+
protected boolean isMachineLearningTest() {
110+
String testName = getTestName();
111+
return testName != null && (testName.contains("/ml/") || testName.contains("\\ml\\"));
112+
}
113+
114+
protected boolean isDataFrameTest() {
115+
String testName = getTestName();
116+
return testName != null && (testName.contains("/data-frames/") || testName.contains("\\data-frames\\"));
117+
}
118+
100119
/**
101120
* Compares the results of running two analyzers against many random
102121
* strings. The goal is to figure out if two anlayzers are "the same" by

0 commit comments

Comments
 (0)