Browse Source

[ML] Fix auditor test failures (#125038)

David Kyle 6 months ago
parent
commit
5778b76cb9

+ 0 - 6
muted-tests.yml

@@ -203,12 +203,6 @@ tests:
   issue: https://github.com/elastic/elasticsearch/issues/120964
 - class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
   issue: https://github.com/elastic/elasticsearch/issues/121165
-- class: org.elasticsearch.xpack.test.rest.XPackRestIT
-  method: test {p0=transform/*}
-  issue: https://github.com/elastic/elasticsearch/issues/120816
-- class: org.elasticsearch.xpack.test.rest.XPackRestIT
-  method: test {p0=ml/*}
-  issue: https://github.com/elastic/elasticsearch/issues/120816
 - class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectorySessionFactoryTests
   issue: https://github.com/elastic/elasticsearch/issues/121285
 - class: org.elasticsearch.env.NodeEnvironmentTests

+ 11 - 0
x-pack/plugin/build.gradle

@@ -111,6 +111,17 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
   task.skipTest("esql/40_tsdb/from index pattern unsupported counter", "TODO: support for subset of metric fields")
   task.skipTest("esql/40_unsupported_types/unsupported", "TODO: support for subset of metric fields")
   task.skipTest("esql/40_unsupported_types/unsupported with sort", "TODO: support for subset of metric fields")
+  task.skipTest("ml/3rd_party_deployment/Test clear deployment cache", "Deprecated route removed")
+  task.skipTest("ml/3rd_party_deployment/Test start and stop deployment with cache", "Deprecated route removed")
+  task.skipTest("ml/3rd_party_deployment/Test start and stop multiple deployments", "Deprecated route removed")
+  task.skipTest("ml/3rd_party_deployment/Test update model alias on pytorch model to undeployed model", "Deprecated route removed")
+  task.skipTest("ml/job_cat_apis/Test cat anomaly detector jobs", "Flush API is deprecated")
+  task.skipTest("ml/jobs_get_stats/Test get job stats after uploading data prompting the creation of some stats", "Flush API is deprecated")
+  task.skipTest("ml/jobs_get_stats/Test get job stats for closed job", "Flush API is deprecated")
+  task.skipTest("ml/inference_crud/Test deprecation of include model definition param", "Query parameter removed")
+  task.skipTest("ml/post_data/Test flush and close job WITHOUT sending any data", "Flush API is deprecated")
+  task.skipTest("ml/post_data/Test flush with skip_time", "Flush API is deprecated")
+  task.skipTest("ml/post_data/Test POST data job api, flush, close and verify DataCounts doc", "Flush API is deprecated")
   task.replaceValueInMatch("Size", 49, "Test flamegraph from profiling-events")
   task.replaceValueInMatch("Size", 49, "Test flamegraph from test-events")
 })

+ 4 - 8
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/notifications/AbstractAuditor.java

@@ -98,11 +98,9 @@ public abstract class AbstractAuditor<T extends AbstractAuditMessage> {
      */
     public void reset() {
         indexAndAliasCreated.set(false);
-        if (backlog == null) {
-            // create a new backlog in case documents need
-            // to be temporarily stored when the new index/alias is created
-            backlog = new ConcurrentLinkedQueue<>();
-        }
+        // create a new backlog in case documents need
+        // to be temporarily stored when the new index/alias is created
+        backlog = new ConcurrentLinkedQueue<>();
     }
 
     private static void onIndexResponse(DocWriteResponse response) {
@@ -134,14 +132,13 @@ public abstract class AbstractAuditor<T extends AbstractAuditMessage> {
             if (indexAndAliasCreated.get() == false) {
                 // synchronized so that hasLatestTemplate does not change value
                 // between the read and adding to the backlog
-                assert backlog != null;
                 if (backlog != null) {
                     if (backlog.size() >= MAX_BUFFER_SIZE) {
                         backlog.remove();
                     }
                     backlog.add(toXContent);
                 } else {
-                    logger.error("Latest audit template missing and audit message cannot be added to the backlog");
+                    logger.error("Audit message cannot be added to the backlog");
                 }
 
                 // stop multiple invocations
@@ -186,7 +183,6 @@ public abstract class AbstractAuditor<T extends AbstractAuditMessage> {
     }
 
     protected void writeBacklog() {
-        assert backlog != null;
         if (backlog == null) {
             logger.debug("Message back log has already been written");
             return;