File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 77
88import org .elasticsearch .common .settings .Settings ;
99import org .elasticsearch .common .xcontent .support .XContentMapValues ;
10+ import org .junit .Before ;
11+ import org .junit .BeforeClass ;
1012
1113import java .io .IOException ;
1214import java .util .Map ;
2022 */
2123public class SemanticTextEISDefaultIT extends BaseMockEISAuthServerTest {
2224
25+ @ Before
26+ public void setUp () throws Exception {
27+ super .setUp ();
28+ // Ensure the mock EIS server has an authorized response ready before each test
29+ mockEISServer .enqueueAuthorizeAllModelsResponse ();
30+ }
31+
32+ /**
33+ * This is done before the class because I've run into issues where another class that extends {@link BaseMockEISAuthServerTest}
34+ * results in an authorization response not being queued up for the new Elasticsearch Node in time. When the node starts up, it
35+ * retrieves authorization. If the request isn't queued up when that happens the tests will fail. From my testing locally it seems
36+ * like the base class's static functionality to queue a response is only done once and not for each subclass.
37+ *
38+ * My understanding is that the @Before will be run after the node starts up and wouldn't be sufficient to handle
39+ * this scenario. That is why this needs to be @BeforeClass.
40+ */
41+ @ BeforeClass
42+ public static void init () {
43+ // Ensure the mock EIS server has an authorized response ready
44+ mockEISServer .enqueueAuthorizeAllModelsResponse ();
45+ }
46+
2347 public void testDefaultInferenceIdForSemanticText () throws IOException {
2448 String indexName = "semantic-index" ;
2549 String mapping = """
You can’t perform that action at this time.
0 commit comments