mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
ML: Fix testMigrateConfigs (#37373)
* ML: :s/execute/get * Fixing other broken tests * unmuting test
This commit is contained in:
parent
de52ba1f78
commit
5101e51891
@ -8,9 +8,11 @@ package org.elasticsearch.xpack.ml.action;
|
|||||||
import org.elasticsearch.ElasticsearchStatusException;
|
import org.elasticsearch.ElasticsearchStatusException;
|
||||||
import org.elasticsearch.ResourceNotFoundException;
|
import org.elasticsearch.ResourceNotFoundException;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.cluster.ClusterName;
|
import org.elasticsearch.cluster.ClusterName;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
@ -455,8 +457,9 @@ public class TransportOpenJobActionTests extends ESTestCase {
|
|||||||
|
|
||||||
metaData = new MetaData.Builder(cs.metaData());
|
metaData = new MetaData.Builder(cs.metaData());
|
||||||
routingTable = new RoutingTable.Builder(cs.routingTable());
|
routingTable = new RoutingTable.Builder(cs.routingTable());
|
||||||
|
IndexNameExpressionResolver indexNameExpressionResolver = new IndexNameExpressionResolver();
|
||||||
String indexToRemove = randomFrom(TransportOpenJobAction.indicesOfInterest(".ml-anomalies-shared"));
|
String indexToRemove = randomFrom(indexNameExpressionResolver.concreteIndexNames(cs, IndicesOptions.lenientExpandOpen(),
|
||||||
|
TransportOpenJobAction.indicesOfInterest(".ml-anomalies-shared")));
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
routingTable.remove(indexToRemove);
|
routingTable.remove(indexToRemove);
|
||||||
} else {
|
} else {
|
||||||
|
@ -51,6 +51,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.elasticsearch.persistent.PersistentTasksClusterService.needsReassignment;
|
import static org.elasticsearch.persistent.PersistentTasksClusterService.needsReassignment;
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.hasEntry;
|
import static org.hamcrest.Matchers.hasEntry;
|
||||||
|
|
||||||
public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
|
public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
|
||||||
@ -399,8 +400,9 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase {
|
|||||||
String detailedMessage = detail.getMessage();
|
String detailedMessage = detail.getMessage();
|
||||||
assertTrue(detailedMessage,
|
assertTrue(detailedMessage,
|
||||||
detailedMessage.startsWith("Could not open job because no suitable nodes were found, allocation explanation"));
|
detailedMessage.startsWith("Could not open job because no suitable nodes were found, allocation explanation"));
|
||||||
assertTrue(detailedMessage, detailedMessage.endsWith("because not all primary shards are active for the following indices " +
|
assertThat(detailedMessage, containsString("because not all primary shards are active for the following indices"));
|
||||||
"[.ml-state,.ml-anomalies-shared]]"));
|
assertThat(detailedMessage, containsString(".ml-state"));
|
||||||
|
assertThat(detailedMessage, containsString(".ml-anomalies-shared"));
|
||||||
|
|
||||||
logger.info("Start data node");
|
logger.info("Start data node");
|
||||||
String nonMlNode = internalCluster().startNode(Settings.builder()
|
String nonMlNode = internalCluster().startNode(Settings.builder()
|
||||||
|
@ -120,7 +120,6 @@ public class MlConfigMigratorIT extends MlSingleNodeTestCase {
|
|||||||
assertNull(alreadyMigratedJob.getCustomSettings());
|
assertNull(alreadyMigratedJob.getCustomSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37374")
|
|
||||||
public void testMigrateConfigs() throws InterruptedException, IOException {
|
public void testMigrateConfigs() throws InterruptedException, IOException {
|
||||||
// and jobs and datafeeds clusterstate
|
// and jobs and datafeeds clusterstate
|
||||||
MlMetadata.Builder mlMetadata = new MlMetadata.Builder();
|
MlMetadata.Builder mlMetadata = new MlMetadata.Builder();
|
||||||
@ -311,7 +310,7 @@ public class MlConfigMigratorIT extends MlSingleNodeTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void assertSnapshot(MlMetadata expectedMlMetadata) throws IOException {
|
public void assertSnapshot(MlMetadata expectedMlMetadata) throws IOException {
|
||||||
client().admin().indices().prepareRefresh(AnomalyDetectorsIndex.jobStateIndexPattern()).execute();
|
client().admin().indices().prepareRefresh(AnomalyDetectorsIndex.jobStateIndexPattern()).get();
|
||||||
SearchResponse searchResponse = client()
|
SearchResponse searchResponse = client()
|
||||||
.prepareSearch(AnomalyDetectorsIndex.jobStateIndexPattern())
|
.prepareSearch(AnomalyDetectorsIndex.jobStateIndexPattern())
|
||||||
.setTypes(ElasticsearchMappings.DOC_TYPE)
|
.setTypes(ElasticsearchMappings.DOC_TYPE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user