Simplify "refresh" calls. (#53385) (#53393)

This commit is contained in:
Przemysław Witek 2020-03-11 12:26:11 +01:00 committed by GitHub
parent cc7751eb16
commit 063957b7d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 17 deletions

View File

@ -9,7 +9,6 @@ import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.ml.MachineLearning;
@ -81,7 +80,7 @@ public class CategorizationIT extends MlNativeAutodetectIntegTestCase {
public void tearDownData() {
cleanUp();
client().admin().indices().prepareDelete(DATA_INDEX).get();
client().admin().indices().prepareRefresh("*").setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN).get();
refresh("*");
}
public void testBasicCategorization() throws Exception {

View File

@ -10,7 +10,6 @@ import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateAction;
import org.elasticsearch.action.update.UpdateRequest;
@ -167,7 +166,7 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
}
// Refresh to ensure the snapshot timestamp updates are visible
client().admin().indices().prepareRefresh("*").setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN).get();
refresh("*");
// We need to wait a second to ensure the second time around model snapshots will have a different ID (it depends on epoch seconds)
// FIXME it would be better to wait for something concrete instead of wait for time to elapse
@ -298,6 +297,6 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
client().execute(UpdateModelSnapshotAction.INSTANCE, request).get();
}
// We need to refresh to ensure the updates are visible
client().admin().indices().prepareRefresh("*").setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN).get();
refresh("*");
}
}

View File

@ -6,7 +6,6 @@
package org.elasticsearch.xpack.ml.integration;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.cluster.ClusterState;
@ -132,7 +131,7 @@ abstract class MlNativeIntegTestCase extends ESIntegTestCase {
new DeleteExpiredDataAction.Request()).get();
// We need to refresh to ensure the deletion is visible
client().admin().indices().prepareRefresh("*").setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN).get();
refresh("*");
return response;
}

View File

@ -165,7 +165,7 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
indexRequest = new IndexRequest("data", "type");
indexRequest.source("time", 1407083600L);
client().index(indexRequest).get();
refresh("*", ".ml-*");
refresh("*");
Job.Builder job = createScheduledJob("job_id");
PutJobAction.Request putJobRequest = new PutJobAction.Request(job);

View File

@ -111,7 +111,7 @@ setup:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
headers:
@ -464,7 +464,7 @@ setup:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
headers:
@ -514,7 +514,7 @@ setup:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
ml.delete_job:
@ -607,7 +607,7 @@ setup:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
ml.delete_job:
@ -685,7 +685,7 @@ setup:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
headers:

View File

@ -471,7 +471,7 @@
- do:
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
catch: /Invalid update value for analysis_limits[:] model_memory_limit cannot be decreased below current usage; current usage \[9mb\], update had \[5mb\]/
@ -928,7 +928,7 @@
- do:
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
catch: /status_exception/
@ -956,7 +956,7 @@
- do:
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
catch: /status_exception/
@ -994,7 +994,7 @@
- do:
indices.refresh:
index: ["*",".ml-*"]
expand_wildcards: all
- do:
catch: /status_exception/