Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters");
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-http");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-disabled");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins");
map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
Expand Down
15 changes: 6 additions & 9 deletions qa/smoke-test-http/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

apply plugin: 'elasticsearch.legacy-java-rest-test'
//apply plugin: 'elasticsearch.test-with-dependencies'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.internal-java-rest-test'

dependencies {
javaRestTestImplementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
javaRestTestImplementation project(':modules:rest-root')
}

testClusters.configureEach {
module ':modules:rest-root'
setting 'xpack.security.enabled', 'false'
internalClusterTestImplementation project(":test:framework")
internalClusterTestImplementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
internalClusterTestImplementation project(':modules:rest-root')
clusterModules project(":modules:rest-root")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.http;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.junit.ClassRule;

public abstract class AbstractHttpSmokeTestIT extends ESRestTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("rest-root").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.Streams;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xcontent.ObjectPath;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.json.JsonXContent;
Expand All @@ -29,7 +28,7 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.containsString;

public class AutoCreateIndexIT extends ESRestTestCase {
public class AutoCreateIndexIT extends AbstractHttpSmokeTestIT {

/**
* Check that setting {@link AutoCreateIndex#AUTO_CREATE_INDEX_SETTING} to <code>false</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.test.rest.ESRestTestCase;

import java.io.IOException;

Expand All @@ -23,7 +22,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;

public class HttpCompressionIT extends ESRestTestCase {
public class HttpCompressionIT extends AbstractHttpSmokeTestIT {

private static final String GZIP_ENCODING = "gzip";
private static final String SAMPLE_DOCUMENT = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.test.rest.ESRestTestCase;

import java.util.Arrays;
import java.util.List;
Expand All @@ -29,7 +28,7 @@
* methods on REST endpoints should respond with status code 405</a> for more
* information.
*/
public class RestHttpResponseHeadersIT extends ESRestTestCase {
public class RestHttpResponseHeadersIT extends AbstractHttpSmokeTestIT {

/**
* For an OPTIONS request to a valid REST endpoint, verify that a 200 HTTP
Expand Down
9 changes: 2 additions & 7 deletions qa/smoke-test-ingest-disabled/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'

dependencies {
testImplementation project(':modules:ingest-common')
}

testClusters.matching { it.name == "yamlRestTest" }.configureEach {
setting 'xpack.security.enabled', 'false'
setting 'node.roles', '[data,master,remote_cluster_client]'
clusterModules project(':modules:ingest-common')
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class SmokeTestIngestDisabledClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("ingest-common")
.setting("xpack.security.enabled", "false")
.setting("node.roles", "[data,master,remote_cluster_client]")
.build();

public SmokeTestIngestDisabledClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
Expand All @@ -26,4 +35,8 @@ public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
26 changes: 10 additions & 16 deletions qa/smoke-test-ingest-with-all-dependencies/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'

dependencies {
yamlRestTestImplementation project(':modules:lang-mustache')
}

testClusters.configureEach {
setting 'xpack.security.enabled', 'false'
extraConfigFile 'ingest-geoip/GeoLite2-City.mmdb', file("src/yamlRestTest/resources/GeoLite2-City.mmdb")
}

tasks.named("yamlRestTestTestingConventions").configure {
baseClass 'org.elasticsearch.ingest.AbstractScriptTestCase'
baseClass 'org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase'
}

tasks.named("forbiddenPatterns").configure {
exclude '**/*.mmdb'
internalClusterTestImplementation project(':test:framework')
internalClusterTestImplementation project(':modules:lang-mustache')
clusterModules project(":modules:ingest-common")
clusterModules project(":modules:lang-mustache")
clusterModules project(":modules:reindex")
clusterModules project(":modules:data-streams")
clusterModules project(":modules:ingest-geoip")
clusterModules project(":modules:mapper-extras")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,25 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.util.resource.Resource;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class SmokeTestIngestWithAllDepsClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("ingest-common")
.module("lang-mustache")
.module("reindex")
.module("data-streams")
.module("ingest-geoip")
.module("mapper-extras")
.configFile("ingest-geoip/GeoLite2-City.mmdb", Resource.fromClasspath("GeoLite2-City.mmdb"))
.build();

public SmokeTestIngestWithAllDepsClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
Expand All @@ -26,4 +40,8 @@ public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
"Test invalid name warnings":
- requires:
cluster_features: [ "ingest.pipeline_name_special_chars_warning" ]
test_runner_features: [ "warnings" ]
reason: verifying deprecation warnings from 9.0 onwards for invalid pipeline names

Expand All @@ -24,5 +23,5 @@
}]
}
warnings:
- "Invalid pipeline id: Invalid*-pipeline:id"
- "Pipeline name [Invalid*-pipeline:id] will be disallowed in a future version for the following reason: must not contain the following characters [' ','\"','*',',','/','<','>','?','\\','|']"
- match: { acknowledged: true }
16 changes: 11 additions & 5 deletions qa/smoke-test-plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,32 @@

import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'

ext.pluginPaths = []
ext.pluginNames = []
project(':plugins').getChildProjects().each { pluginName, pluginProject ->
pluginPaths << pluginProject.path
pluginNames << pluginName
}

testClusters.matching { it.name == "yamlRestTest" }.configureEach {
dependencies {
clusterModules project(":modules:lang-painless")
pluginPaths.each { pluginPath ->
plugin pluginPath
clusterPlugins(project(pluginPath))
}
setting 'xpack.security.enabled', 'false'
}

ext.expansions = [
'expected.plugins.count': pluginPaths.size()
]

tasks.named("processYamlRestTestResources").configure {
tasks.named("processYamlRestTestResources") {
assert pluginPaths.size() > 0
inputs.properties(expansions)
filter("tokens" : expansions.collectEntries {k, v -> [k, v.toString()]} /* must be a map of strings */, ReplaceTokens.class)
}

tasks.named("yamlRestTest") {
systemProperty('tests.plugin.names', pluginNames.join(','))
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class SmokeTestPluginsClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().apply(c -> {
for (String plugin : System.getProperty("tests.plugin.names").split(",")) {
c.plugin(plugin);
}
}).module("lang-painless").setting("xpack.security.enabled", "false").build();

public SmokeTestPluginsClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
Expand All @@ -25,4 +34,9 @@ public SmokeTestPluginsClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandida
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
11 changes: 5 additions & 6 deletions qa/system-indices/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

apply plugin: 'elasticsearch.base-internal-es-plugin'
apply plugin: 'elasticsearch.legacy-java-rest-test'
apply plugin: 'elasticsearch.internal-java-rest-test'

esplugin {
name = 'system-indices-qa'
Expand All @@ -18,9 +18,8 @@ esplugin {
noticeFile = layout.settingsDirectory.file('NOTICE.txt').asFile
}

testClusters.configureEach {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.security.autoconfiguration.enabled', 'false'
user username: 'rest_user', password: 'rest-user-password'
dependencies {
clusterModules project(':modules:analysis-common')
clusterModules project(':modules:ingest-common')
clusterModules project(':x-pack:plugin:migrate')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.system.indices;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.junit.ClassRule;

public abstract class AbstractSystemIndicesIT extends ESRestTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.plugin("system-indices-qa")
.module("analysis-common")
.module("ingest-common")
.module("x-pack-migrate")
.build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.test.XContentTestUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.junit.After;

import java.util.Collections;
Expand All @@ -29,20 +25,13 @@
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;

public class FeatureUpgradeApiIT extends ESRestTestCase {

static final String BASIC_AUTH_VALUE = basicAuthHeaderValue("rest_user", new SecureString("rest-user-password".toCharArray()));
public class FeatureUpgradeApiIT extends AbstractSystemIndicesIT {

@After
public void resetFeatures() throws Exception {
client().performRequest(new Request("POST", "/_features/_reset"));
}

@Override
protected Settings restClientSettings() {
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", BASIC_AUTH_VALUE).build();
}

public void testCreatingSystemIndex() throws Exception {
var request = new Request("PUT", "/_net_new_sys_index/_create");
request.setOptions(RequestOptions.DEFAULT.toBuilder().addHeader("X-elastic-product-origin", "elastic"));
Expand Down
Loading