Skip to content

Commit

Permalink
don't delete ingest pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Nov 8, 2024
1 parent dc5a4a8 commit 4aa73fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public MlRestTestStateCleaner(Logger logger, RestClient adminClient) {
}

public void resetFeatures() throws IOException {
waitForMlStatsIndexToInitialize();
deleteAllTrainedModelIngestPipelines();
// This resets all features, not just ML, but they should have been getting reset between tests anyway so it shouldn't matter
adminClient.performRequest(new Request("POST", "/_features/_reset"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponseException;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.elasticsearch.xpack.core.ml.integration.MlRestTestStateCleaner;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFields;
import org.elasticsearch.xpack.core.ml.notifications.NotificationsIndex;
Expand Down Expand Up @@ -114,6 +115,7 @@ protected void waitForLicense() {
*/
@After
public void cleanup() throws Exception {
clearMlState();
if (isWaitForPendingTasks()) {
// This waits for pending tasks to complete, so must go last (otherwise
// it could be waiting for pending tasks while monitoring is still running).
Expand All @@ -128,6 +130,15 @@ protected Predicate<String> waitForPendingTasksFilter() {
};
}

/**
* Delete any left over machine learning datafeeds and jobs.
*/
private void clearMlState() throws Exception {
if (isMachineLearningTest()) {
new MlRestTestStateCleaner(logger, adminClient()).resetFeatures();
}
}

/**
* Executes an API call using the admin context, waiting for it to succeed.
*/
Expand Down

0 comments on commit 4aa73fe

Please sign in to comment.