Skip to content

Commit 6cff2c3

Browse files
committed
Use test ML model server in xpack rest tests
1 parent d37ee2f commit 6cff2c3

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

x-pack/plugin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ base {
1818
}
1919

2020
dependencies {
21+
testImplementation(testArtifact(project(':x-pack:plugin:inference:qa:inference-service-tests'), "javaRestTest"))
2122
testImplementation project(xpackModule('core'))
2223
testImplementation(testArtifact(project(xpackModule('core'))))
2324
testImplementation(testArtifact(project(":x-pack:plugin:security:qa:service-account"), "javaRestTest"))

x-pack/plugin/inference/qa/inference-service-tests/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'elasticsearch.internal-java-rest-test'
2+
apply plugin: 'elasticsearch.internal-test-artifact'
23

34
dependencies {
45
javaRestTestImplementation project(path: xpackModule('core'))

x-pack/plugin/src/test/java/org/elasticsearch/xpack/test/rest/AbstractXPackRestTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import java.util.concurrent.atomic.AtomicReference;
3838
import java.util.function.Predicate;
3939
import java.util.function.Supplier;
40+
import org.elasticsearch.xpack.inference.MlModelServer;
41+
import org.junit.ClassRule;
4042

4143
import static java.util.Collections.emptyList;
4244
import static java.util.Collections.singletonMap;
@@ -50,6 +52,14 @@ public abstract class AbstractXPackRestTest extends ESClientYamlSuiteTestCase {
5052
SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING
5153
);
5254

55+
@ClassRule
56+
public static MlModelServer mlModelServer = new MlModelServer();
57+
58+
@Before
59+
public void setMlModelRepository() throws IOException {
60+
assertOK(mlModelServer.setMlModelRepository(client()));
61+
}
62+
5363
public AbstractXPackRestTest(ClientYamlTestCandidate testCandidate) {
5464
super(testCandidate);
5565
}

0 commit comments

Comments
 (0)