Skip to content

Commit 2b4b8d5

Browse files
authored
[8.19] Migrate remaining x-pack downsample Rest tests (elastic#131464)
1 parent 0dc8f36 commit 2b4b8d5

File tree

7 files changed

+55
-72
lines changed

7 files changed

+55
-72
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
6060
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:autoscaling:qa:rest");
6161
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
6262
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
63-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
6463
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest");
6564
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest-with-advanced-security");
6665
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:enrich:qa:rest-with-security");

x-pack/plugin/downsample/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public DownsampleRestIT(final ClientYamlTestCandidate testCandidate) {
3535

3636
@ParametersFactory
3737
public static Iterable<Object[]> parameters() throws Exception {
38-
return ESClientYamlSuiteTestCase.createParameters();
38+
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample" });
3939
}
4040

4141
}

x-pack/plugin/downsample/qa/rest/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleWithBasicRestIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public DownsampleWithBasicRestIT(final ClientYamlTestCandidate testCandidate) {
3434

3535
@ParametersFactory
3636
public static Iterable<Object[]> parameters() throws Exception {
37-
return ESClientYamlSuiteTestCase.createParameters();
37+
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample" });
3838
}
3939

4040
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.downsample;
9+
10+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
11+
12+
import org.elasticsearch.common.settings.SecureString;
13+
import org.elasticsearch.common.settings.Settings;
14+
import org.elasticsearch.common.util.concurrent.ThreadContext;
15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
16+
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
17+
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
18+
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
19+
import org.junit.ClassRule;
20+
21+
public class DownsampleWithSecurityRestIT extends ESClientYamlSuiteTestCase {
22+
23+
public static final String USERNAME = "elastic_admin";
24+
public static final String PASSWORD = "admin-password";
25+
26+
@ClassRule
27+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
28+
.distribution(DistributionType.DEFAULT)
29+
.setting("xpack.license.self_generated.type", "trial")
30+
.setting("xpack.security.enabled", "true")
31+
.user(USERNAME, PASSWORD)
32+
.build();
33+
34+
@Override
35+
protected String getTestRestCluster() {
36+
return cluster.getHttpAddresses();
37+
}
38+
39+
public DownsampleWithSecurityRestIT(final ClientYamlTestCandidate testCandidate) {
40+
super(testCandidate);
41+
}
42+
43+
@Override
44+
protected Settings restClientSettings() {
45+
String authentication = basicAuthHeaderValue(USERNAME, new SecureString(PASSWORD.toCharArray()));
46+
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", authentication).build();
47+
}
48+
49+
@ParametersFactory
50+
public static Iterable<Object[]> parameters() throws Exception {
51+
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample-with-security" });
52+
}
53+
}

x-pack/plugin/downsample/qa/with-security/build.gradle

Lines changed: 0 additions & 34 deletions
This file was deleted.

x-pack/plugin/downsample/qa/with-security/src/yamlRestTest/java/org/elasticsearch/xpack/downsample/DownsampleRestIT.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)