Skip to content

Migrate downsample REST with security tests #131453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:correctness");
Expand Down
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,6 @@ tests:
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
method: testFromEvalStats
issue: https://github.com/elastic/elasticsearch/issues/131503
- class: org.elasticsearch.xpack.downsample.DownsampleWithBasicRestIT
method: test {p0=downsample-with-security/10_basic/Downsample index}
issue: https://github.com/elastic/elasticsearch/issues/131513
- class: org.elasticsearch.xpack.search.CrossClusterAsyncSearchIT
method: testCancellationViaTimeoutWithAllowPartialResultsSetToFalse
issue: https://github.com/elastic/elasticsearch/issues/131248
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DownsampleRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample" });
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public DownsampleWithBasicRestIT(final ClientYamlTestCandidate testCandidate) {

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample" });
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

package org.elasticsearch.xpack.downsample;

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class DownsampleWithSecurityRestIT extends ESClientYamlSuiteTestCase {

public static final String USERNAME = "elastic_admin";
public static final String PASSWORD = "admin-password";

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.setting("xpack.license.self_generated.type", "trial")
.setting("xpack.security.enabled", "true")
.user(USERNAME, PASSWORD)
.build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}

public DownsampleWithSecurityRestIT(final ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}

@Override
protected Settings restClientSettings() {
String authentication = basicAuthHeaderValue(USERNAME, new SecureString(PASSWORD.toCharArray()));
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", authentication).build();
}

@ParametersFactory
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters(new String[] { "downsample-with-security" });
}
}
33 changes: 0 additions & 33 deletions x-pack/plugin/downsample/qa/with-security/build.gradle

This file was deleted.

This file was deleted.