[TEST] Attempt to reduce `MockPageCacheRecycler` assertion failures by waiting until there are no active recoveries.
Original commit: elastic/x-pack-elasticsearch@1b142f29bc
This commit is contained in:
parent
2c5e32f3d3
commit
8ecdf3b288
|
@ -6,6 +6,7 @@
|
||||||
package org.elasticsearch.xpack.ml.support;
|
package org.elasticsearch.xpack.ml.support;
|
||||||
|
|
||||||
import org.elasticsearch.ExceptionsHelper;
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
|
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||||
import org.elasticsearch.action.bulk.BulkResponse;
|
import org.elasticsearch.action.bulk.BulkResponse;
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
|
@ -14,6 +15,7 @@ import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
import org.elasticsearch.indices.recovery.RecoveryState;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.SecurityIntegTestCase;
|
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||||
|
@ -139,13 +141,18 @@ public abstract class BaseMlIntegTestCase extends SecurityIntegTestCase {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Due to the fact that ml plugin creates the state, notifications and meta indices automatically
|
|
||||||
// when the test framework removes all indices then ml plugin adds them back. Causing validation to fail
|
|
||||||
// we should move to templates instead as that will fix the test problem
|
|
||||||
@After
|
@After
|
||||||
public void cleanupWorkaround() throws Exception {
|
public void cleanupWorkaround() throws Exception {
|
||||||
deleteAllDatafeeds(client());
|
deleteAllDatafeeds(client());
|
||||||
deleteAllJobs(client());
|
deleteAllJobs(client());
|
||||||
|
assertBusy(() -> {
|
||||||
|
RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries()
|
||||||
|
.setActiveOnly(true)
|
||||||
|
.get();
|
||||||
|
for (List<RecoveryState> recoveryStates : recoveryResponse.shardRecoveryStates().values()) {
|
||||||
|
assertThat(recoveryStates.size(), equalTo(0));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void indexDocs(String index, long numDocs, long start, long end) {
|
protected void indexDocs(String index, long numDocs, long start, long end) {
|
||||||
|
|
Loading…
Reference in New Issue