浏览代码

Resolve inference release tests failing due to missing feature flag (#131841)

Kathleen DeRusso 2 月之前
父节点
当前提交
83b05c6161

+ 8 - 0
x-pack/plugin/inference/src/yamlRestTest/java/org/elasticsearch/xpack/inference/InferenceRestIT.java

@@ -9,10 +9,12 @@ package org.elasticsearch.xpack.inference;
 
 import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
 
+import org.elasticsearch.Build;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.test.cluster.ElasticsearchCluster;
+import org.elasticsearch.test.cluster.FeatureFlag;
 import org.elasticsearch.test.cluster.local.distribution.DistributionType;
 import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
 import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
@@ -21,6 +23,7 @@ import org.junit.ClassRule;
 
 import java.io.IOException;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 public class InferenceRestIT extends ESClientYamlSuiteTestCase {
@@ -31,12 +34,17 @@ public class InferenceRestIT extends ESClientYamlSuiteTestCase {
         .setting("xpack.security.enabled", "false")
         .setting("xpack.security.http.ssl.enabled", "false")
         .setting("xpack.license.self_generated.type", "trial")
+        .feature(FeatureFlag.RERANK_SNIPPETS)
         .plugin("inference-service-test")
         .distribution(DistributionType.DEFAULT)
         .build();
 
     public InferenceRestIT(final ClientYamlTestCandidate testCandidate) {
         super(testCandidate);
+        String testPath = testCandidate.getTestPath();
+        if (testPath.startsWith("inference/70_text_similarity_rank_retriever") && testPath.toLowerCase(Locale.ROOT).contains("snippet")) {
+            assumeTrue("Rerank snippets does not work in release builds", Build.current().isSnapshot());
+        }
     }
 
     @Override