Skip to content

Commit 3ac1472

Browse files
jan-elasticelasticsearchmachine
andauthored
[8.x] backport datafeeds test fixes (#120289)
* Fix(?) and unmute DatafeedJobsRestIT. (#119839) * Fix(?) and unmute DatafeedJobsRestIT. * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <[email protected]> * Datafeed jobs it wait for task cancel (#120177) * Fix task cancellation in DatafeedJobsIT. * fix * unmute DatafeedJobsIT * unmute --------- Co-authored-by: elasticsearchmachine <[email protected]>
1 parent 9f475f3 commit 3ac1472

File tree

3 files changed

+18
-63
lines changed

3 files changed

+18
-63
lines changed

muted-tests.yml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,9 @@ tests:
213213
issue: https://github.com/elastic/elasticsearch/issues/115664
214214
- class: org.elasticsearch.indices.mapping.UpdateMappingIntegrationIT
215215
issue: https://github.com/elastic/elasticsearch/issues/116126
216-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsRestIT
217-
issue: https://github.com/elastic/elasticsearch/issues/111319
218216
- class: org.elasticsearch.upgrades.FullClusterRestartIT
219217
method: testSnapshotRestore {cluster=OLD}
220218
issue: https://github.com/elastic/elasticsearch/issues/111777
221-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsRestIT
222-
method: testLookbackWithIndicesOptions
223-
issue: https://github.com/elastic/elasticsearch/issues/116127
224219
- class: org.elasticsearch.xpack.restart.CoreFullClusterRestartIT
225220
method: testSnapshotRestore {cluster=UPGRADED}
226221
issue: https://github.com/elastic/elasticsearch/issues/111799
@@ -432,48 +427,9 @@ tests:
432427
- class: org.elasticsearch.oldrepos.OldRepositoryAccessIT
433428
method: testOldSourceOnlyRepoAccess
434429
issue: https://github.com/elastic/elasticsearch/issues/120080
435-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
436-
method: testLookbackOnlyDataStream
437-
issue: https://github.com/elastic/elasticsearch/issues/120102
438-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
439-
method: testCloseJobStopsLookbackOnlyDatafeed
440-
issue: https://github.com/elastic/elasticsearch/issues/120103
441-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
442-
method: testCloseJobStopsRealtimeDatafeed
443-
issue: https://github.com/elastic/elasticsearch/issues/120104
444-
- class: org.elasticsearch.search.basic.SearchWithRandomIOExceptionsIT
445-
method: testRandomDirectoryIOExceptions
446-
issue: https://github.com/elastic/elasticsearch/issues/118733
447-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
448-
method: testLookbackOnlyRuntimeMapping
449-
issue: https://github.com/elastic/elasticsearch/issues/120153
450-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
451-
method: testRealtime_multipleStopCalls
452-
issue: https://github.com/elastic/elasticsearch/issues/120154
453-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
454-
method: testStopAndRestartCompositeDatafeed
455-
issue: https://github.com/elastic/elasticsearch/issues/120160
456-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
457-
method: testStopLookbackFollowedByProcessKill
458-
issue: https://github.com/elastic/elasticsearch/issues/120122
459-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
460-
method: testLookbackOnly
461-
issue: https://github.com/elastic/elasticsearch/issues/120166
462-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
463-
method: testStart_GivenAggregateMetricDoubleWithoutAggs
464-
issue: https://github.com/elastic/elasticsearch/issues/120152
465-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
466-
method: testRealtime_givenSimultaneousStopAndForceDelete
467-
issue: https://github.com/elastic/elasticsearch/issues/120161
468430
- class: org.elasticsearch.xpack.ml.integration.ClassificationHousePricingIT
469431
method: testFeatureImportanceValues
470432
issue: https://github.com/elastic/elasticsearch/issues/116564
471-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
472-
method: testRealtime_noDataAndAutoStop
473-
issue: https://github.com/elastic/elasticsearch/issues/120167
474-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
475-
method: testStartDatafeed_GivenNegativeStartTime_Returns408
476-
issue: https://github.com/elastic/elasticsearch/issues/120169
477433
- class: org.elasticsearch.xpack.searchablesnapshots.minio.MinioSearchableSnapshotsIT
478434
issue: https://github.com/elastic/elasticsearch/issues/120101
479435
- class: org.elasticsearch.repositories.s3.RepositoryS3MinioBasicCredentialsRestIT
@@ -486,9 +442,6 @@ tests:
486442
- class: org.elasticsearch.xpack.inference.InferenceCrudIT
487443
method: testGetServicesWithCompletionTaskType
488444
issue: https://github.com/elastic/elasticsearch/issues/119959
489-
- class: org.elasticsearch.xpack.ml.integration.DatafeedJobsIT
490-
method: testDatafeedTimingStats_QueryDelayUpdated_TimingStatsNotReset
491-
issue: https://github.com/elastic/elasticsearch/issues/120121
492445
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
493446
method: test {date.Implicit casting strings to dates for IN operator SYNC}
494447
issue: https://github.com/elastic/elasticsearch/issues/120159

x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ public void cleanup() {
8383
updateClusterSettings(Settings.builder().putNull("logger.org.elasticsearch.xpack.ml.datafeed"));
8484
cleanUp();
8585
// Race conditions between closing and killing tasks in these tests,
86-
// sometimes result in lingering persistent tasks (such as "_close"),
87-
// which cause subsequent tests to fail.
88-
client().execute(TransportCancelTasksAction.TYPE, new CancelTasksRequest());
86+
// sometimes result in lingering persistent close tasks, which cause
87+
// subsequent tests to fail. Therefore, they're explicitly cancelled.
88+
CancelTasksRequest cancelTasksRequest = new CancelTasksRequest();
89+
cancelTasksRequest.setActions("*close*");
90+
cancelTasksRequest.setWaitForCompletion(true);
91+
client().execute(TransportCancelTasksAction.TYPE, cancelTasksRequest).actionGet();
8992
}
9093

9194
public void testLookbackOnly() throws Exception {

x-pack/plugin/ml/qa/native-multi-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import static org.hamcrest.Matchers.anyOf;
3838
import static org.hamcrest.Matchers.containsString;
3939
import static org.hamcrest.Matchers.equalTo;
40-
import static org.hamcrest.Matchers.not;
4140

4241
public class DatafeedJobsRestIT extends ESRestTestCase {
4342

@@ -503,12 +502,12 @@ public void testLookbackWithIndicesOptions() throws Exception {
503502
}""");
504503
client().performRequest(createJobRequest);
505504
String datafeedId = jobId + "-datafeed";
506-
new DatafeedBuilder(datafeedId, jobId, "*hidden-*").setIndicesOptions("""
505+
new DatafeedBuilder(datafeedId, jobId, "hidden-*").setIndicesOptions("""
507506
{"expand_wildcards": ["all"],"allow_no_indices": true}""").build();
508507

509508
StringBuilder bulk = new StringBuilder();
510509

511-
Request createGeoData = new Request("PUT", "/.hidden-index");
510+
Request createGeoData = new Request("PUT", "/hidden-index");
512511
createGeoData.setJsonEntity("""
513512
{
514513
"mappings": {
@@ -528,23 +527,23 @@ public void testLookbackWithIndicesOptions() throws Exception {
528527
client().performRequest(createGeoData);
529528

530529
bulk.append("""
531-
{"index": {"_index": ".hidden-index", "_id": 1}}
530+
{"index": {"_index": "hidden-index", "_id": 1}}
532531
{"time":"2016-06-01T00:00:00Z","value": 1000}
533-
{"index": {"_index": ".hidden-index", "_id": 2}}
532+
{"index": {"_index": "hidden-index", "_id": 2}}
534533
{"time":"2016-06-01T00:05:00Z","value":1500}
535-
{"index": {"_index": ".hidden-index", "_id": 3}}
534+
{"index": {"_index": "hidden-index", "_id": 3}}
536535
{"time":"2016-06-01T00:10:00Z","value":1600}
537-
{"index": {"_index": ".hidden-index", "_id": 4}}
536+
{"index": {"_index": "hidden-index", "_id": 4}}
538537
{"time":"2016-06-01T00:15:00Z","value":100}
539-
{"index": {"_index": ".hidden-index", "_id": 5}}
538+
{"index": {"_index": "hidden-index", "_id": 5}}
540539
{"time":"2016-06-01T00:20:00Z","value":1}
541-
{"index": {"_index": ".hidden-index", "_id": 6}}
540+
{"index": {"_index": "hidden-index", "_id": 6}}
542541
{"time":"2016-06-01T00:25:00Z","value":1500}
543-
{"index": {"_index": ".hidden-index", "_id": 7}}
542+
{"index": {"_index": "hidden-index", "_id": 7}}
544543
{"time":"2016-06-01T00:30:00Z","value":1500}
545-
{"index": {"_index": ".hidden-index", "_id": 8}}
544+
{"index": {"_index": "hidden-index", "_id": 8}}
546545
{"time":"2016-06-01T00:40:00Z","value":2100}
547-
{"index": {"_index": ".hidden-index", "_id": 9}}
546+
{"index": {"_index": "hidden-index", "_id": 9}}
548547
{"time":"2016-06-01T00:41:00Z","value":0}
549548
""");
550549
bulkIndex(bulk.toString());
@@ -1802,7 +1801,7 @@ private void bulkIndex(String bulk) throws IOException {
18021801
bulkRequest.addParameter("refresh", "true");
18031802
bulkRequest.addParameter("pretty", null);
18041803
String bulkResponse = EntityUtils.toString(client().performRequest(bulkRequest).getEntity());
1805-
assertThat(bulkResponse, not(containsString("\"errors\": false")));
1804+
assertThat(bulkResponse, containsString("\"errors\" : false"));
18061805
}
18071806

18081807
private Response createJobAndDataFeed(String jobId, String datafeedId) throws IOException {

0 commit comments

Comments
 (0)