Skip to content

Commit c12af75

Browse files
committed
Migrate x-pack-autoscaling REST tests (elastic#131365)
This PR migrates legacy rest tests in the x-pack autoscaling module
1 parent 2b4b8d5 commit c12af75

File tree

10 files changed

+38
-41
lines changed

10 files changed

+38
-41
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:enrich:qa:rest");
Lines changed: 21 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,27 @@ 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'))
30+
}
31+
32+
restResources {
33+
restApi {
34+
include '_common', 'autoscaling'
35+
}
2736
}
2837

29-
addQaCheckDependencies(project)
38+
tasks.named("yamlRestTestV7CompatTest").configure {
39+
systemProperty 'tests.rest.blacklist', [
40+
"autoscaling/get_autoscaling_capacity/Test get fixed autoscaling capacity",
41+
].join(',')
42+
}

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

Whitespace-only changes.

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

Lines changed: 0 additions & 29 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)