Skip to content

Commit 32e50d0

Browse files
authored
Migrate x-pack-autoscaling REST tests (#131365)
This PR migrates legacy rest tests in the x-pack autoscaling module
1 parent ec7f77b commit 32e50d0

File tree

10 files changed

+32
-40
lines changed

10 files changed

+32
-40
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
5656
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:jira");
5757
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:pagerduty");
5858
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack");
59-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:async-search:qa:rest");
60-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:autoscaling:qa:rest");
6159
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
6260
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
6361
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apply plugin: 'elasticsearch.internal-es-plugin'
22
apply plugin: 'elasticsearch.internal-cluster-test'
3+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
34

45
esplugin {
56
name = 'x-pack-autoscaling'
@@ -15,15 +16,21 @@ base {
1516

1617
dependencies {
1718
compileOnly project(path: xpackModule('core'))
18-
testImplementation(testArtifact(project(xpackModule('core'))))
19-
testImplementation project(':modules:data-streams')
20-
testImplementation project(path: xpackModule('blob-cache'))
21-
testImplementation project(path: xpackModule('searchable-snapshots'))
22-
testImplementation project(path: xpackModule('ilm'))
23-
testImplementation project(path: xpackModule('slm'))
24-
testImplementation project(path: xpackModule('ccr'))
2519

20+
testImplementation testArtifact(project(':server'))
21+
testImplementation testArtifact(project(xpackModule('core')))
2622
testImplementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
23+
24+
internalClusterTestImplementation project(':modules:data-streams')
25+
internalClusterTestImplementation project(xpackModule('blob-cache'))
26+
internalClusterTestImplementation project(xpackModule("searchable-snapshots"))
27+
internalClusterTestImplementation project(xpackModule('ilm'))
28+
internalClusterTestImplementation project(xpackModule('slm'))
29+
internalClusterTestImplementation project(xpackModule('ccr'))
2730
}
2831

29-
addQaCheckDependencies(project)
32+
restResources {
33+
restApi {
34+
include '_common', 'autoscaling'
35+
}
36+
}

x-pack/plugin/autoscaling/qa/build.gradle

Whitespace-only changes.

x-pack/plugin/autoscaling/qa/rest/build.gradle

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@
1212
import org.elasticsearch.common.settings.SecureString;
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.common.util.concurrent.ThreadContext;
15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
16+
import org.elasticsearch.test.cluster.util.resource.Resource;
1517
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1618
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
17-
18-
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
19+
import org.junit.ClassRule;
1920

2021
public class AutoscalingRestIT extends ESClientYamlSuiteTestCase {
2122

23+
@ClassRule
24+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
25+
.module("x-pack-autoscaling")
26+
.setting("xpack.security.enabled", "true")
27+
.setting("xpack.license.self_generated.type", "trial")
28+
.rolesFile(Resource.fromClasspath("autoscaling-roles.yml"))
29+
.user("autoscaling-admin", "autoscaling-admin-password", "superuser", false)
30+
.user("autoscaling-user", "autoscaling-user-password", "autoscaling", false)
31+
.build();
32+
2233
public AutoscalingRestIT(final ClientYamlTestCandidate testCandidate) {
2334
super(testCandidate);
2435
}
@@ -40,4 +51,8 @@ protected Settings restClientSettings() {
4051
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", value).build();
4152
}
4253

54+
@Override
55+
protected String getTestRestCluster() {
56+
return cluster.getHttpAddresses();
57+
}
4358
}

0 commit comments

Comments
 (0)