Skip to content

Commit b6462c7

Browse files
authored
Convert x-pack fleet project to new test framework (#125743) (#125978)
(cherry picked from commit e75891e) # Conflicts: # x-pack/plugin/fleet/qa/rest/build.gradle
1 parent c916854 commit b6462c7

File tree

15 files changed

+42
-49
lines changed

15 files changed

+42
-49
lines changed

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

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
3737
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
3838
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
3939
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
40-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
4140
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash");
4241
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile");
4342
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster");
@@ -77,7 +76,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
7776
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade");
7877
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:correctness");
7978
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:mixed-node");
80-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet:qa:rest");
8179
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:identity-provider:qa:idp-rest-tests");
8280
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-cluster");
8381
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-node");

Diff for: x-pack/plugin/fleet/build.gradle

+5-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
apply plugin: 'elasticsearch.internal-es-plugin'
99
apply plugin: 'elasticsearch.internal-cluster-test'
10-
apply plugin: 'elasticsearch.legacy-java-rest-test'
10+
apply plugin: 'elasticsearch.internal-java-rest-test'
11+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
12+
apply plugin: 'elasticsearch.internal-test-artifact'
1113

1214
esplugin {
1315
name = 'x-pack-fleet'
@@ -22,12 +24,7 @@ dependencies {
2224
javaRestTestImplementation(project(path: xpackModule('core')))
2325
javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
2426
compileOnly project(path: xpackModule('ilm'))
25-
}
2627

27-
testClusters.configureEach {
28-
testDistribution = 'DEFAULT'
29-
setting 'xpack.security.enabled', 'true'
30-
setting 'xpack.security.autoconfiguration.enabled', 'false'
31-
user username: 'x_pack_rest_user', password: 'x-pack-test-password'
32-
systemProperty 'es.queryable_built_in_roles_enabled', 'false'
28+
clusterModules project(xpackModule('ilm'))
29+
clusterModules project(':modules:data-streams')
3330
}

Diff for: x-pack/plugin/fleet/qa/build.gradle

Whitespace-only changes.

Diff for: x-pack/plugin/fleet/qa/rest/build.gradle

-31
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.xpack.fleet;
9+
10+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
11+
import org.elasticsearch.test.rest.ESRestTestCase;
12+
import org.junit.ClassRule;
13+
14+
public abstract class AbstractFleetIT extends ESRestTestCase {
15+
16+
@ClassRule
17+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
18+
.module("x-pack-fleet")
19+
.module("x-pack-ilm")
20+
.module("data-streams")
21+
.setting("xpack.security.enabled", "true")
22+
.setting("xpack.security.autoconfiguration.enabled", "false")
23+
.user("x_pack_rest_user", "x-pack-test-password")
24+
.systemProperty("es.queryable_built_in_roles_enabled", "false")
25+
.build();
26+
27+
@Override
28+
protected String getTestRestCluster() {
29+
return cluster.getHttpAddresses();
30+
}
31+
}

Diff for: x-pack/plugin/fleet/src/javaRestTest/java/org/elasticsearch/xpack/fleet/FleetDataStreamIT.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.common.settings.Settings;
1616
import org.elasticsearch.common.util.concurrent.ThreadContext;
1717
import org.elasticsearch.test.SecuritySettingsSourceField;
18-
import org.elasticsearch.test.rest.ESRestTestCase;
1918

2019
import java.util.List;
2120

@@ -26,7 +25,7 @@
2625
import static org.hamcrest.Matchers.is;
2726
import static org.hamcrest.Matchers.not;
2827

29-
public class FleetDataStreamIT extends ESRestTestCase {
28+
public class FleetDataStreamIT extends AbstractFleetIT {
3029

3130
static final String BASIC_AUTH_VALUE = basicAuthHeaderValue(
3231
"x_pack_rest_user",

Diff for: x-pack/plugin/fleet/src/javaRestTest/java/org/elasticsearch/xpack/fleet/FleetSecretsSystemIndexIT.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.common.util.concurrent.ThreadContext;
1717
import org.elasticsearch.common.xcontent.XContentHelper;
1818
import org.elasticsearch.test.SecuritySettingsSourceField;
19-
import org.elasticsearch.test.rest.ESRestTestCase;
2019
import org.elasticsearch.xcontent.XContentBuilder;
2120
import org.elasticsearch.xcontent.XContentType;
2221
import org.elasticsearch.xcontent.json.JsonXContent;
@@ -26,7 +25,7 @@
2625

2726
import static org.hamcrest.Matchers.is;
2827

29-
public class FleetSecretsSystemIndexIT extends ESRestTestCase {
28+
public class FleetSecretsSystemIndexIT extends AbstractFleetIT {
3029
static final String BASIC_AUTH_VALUE = basicAuthHeaderValue(
3130
"x_pack_rest_user",
3231
SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING

Diff for: x-pack/plugin/fleet/src/javaRestTest/java/org/elasticsearch/xpack/fleet/FleetSystemIndicesIT.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.elasticsearch.common.util.concurrent.ThreadContext;
1515
import org.elasticsearch.common.xcontent.XContentHelper;
1616
import org.elasticsearch.test.SecuritySettingsSourceField;
17-
import org.elasticsearch.test.rest.ESRestTestCase;
1817
import org.elasticsearch.xcontent.XContentType;
1918

2019
import java.util.Map;
@@ -23,7 +22,7 @@
2322
import static org.hamcrest.Matchers.equalTo;
2423
import static org.hamcrest.Matchers.not;
2524

26-
public class FleetSystemIndicesIT extends ESRestTestCase {
25+
public class FleetSystemIndicesIT extends AbstractFleetIT {
2726

2827
static final String BASIC_AUTH_VALUE = basicAuthHeaderValue(
2928
"x_pack_rest_user",

Diff for: x-pack/plugin/fleet/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/fleet/FleetRestIT.java renamed to x-pack/plugin/fleet/src/yamlRestTest/java/org/elasticsearch/xpack/fleet/FleetRestIT.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.common.util.concurrent.ThreadContext;
1515
import org.elasticsearch.test.cluster.ElasticsearchCluster;
16-
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
1716
import org.elasticsearch.test.cluster.util.resource.Resource;
1817
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1918
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
@@ -27,7 +26,9 @@ public FleetRestIT(final ClientYamlTestCandidate testCandidate) {
2726

2827
@ClassRule
2928
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
30-
.distribution(DistributionType.DEFAULT)
29+
.module("x-pack-fleet")
30+
.module("x-pack-ilm")
31+
.module("data-streams")
3132
.setting("xpack.license.self_generated.type", "basic")
3233
.setting("xpack.security.enabled", "true")
3334
.rolesFile(Resource.fromClasspath("roles.yml"))

0 commit comments

Comments
 (0)