Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:repository-old-versions");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade");
Expand Down Expand Up @@ -92,8 +90,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:tls-basic");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:multi-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:rolling-upgrade");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:multi-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:fs");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:license-enforcing");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:hdfs");
Expand All @@ -106,12 +102,10 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:mixed-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:with-ssl");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:without-ssl");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:stack:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:text-structure:qa:text-structure-with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-cluster-tests-with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:single-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile:qa:multi-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:with-security");
return map;
Expand Down
8 changes: 2 additions & 6 deletions x-pack/plugin/logstash/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.legacy-java-rest-test'
apply plugin: 'elasticsearch.internal-java-rest-test'

esplugin {
name = 'x-pack-logstash'
Expand All @@ -17,10 +17,6 @@ dependencies {
testImplementation(testArtifact(project(xpackModule('core'))))
javaRestTestImplementation(project(path: xpackModule('core')))
javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
}

testClusters.configureEach {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
user username: 'x_pack_rest_user', password: 'x-pack-test-password'
clusterModules project(':modules:analysis-common')
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.test.SecuritySettingsSourceField;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xcontent.json.JsonXContent;
import org.junit.ClassRule;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -31,6 +33,15 @@
import static org.hamcrest.Matchers.is;

public class LogstashSystemIndexIT extends ESRestTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("x-pack-logstash")
.module("analysis-common")
.setting("xpack.security.enabled", "true")
.user("x_pack_rest_user", "x-pack-test-password")
.build();

static final String BASIC_AUTH_VALUE = basicAuthHeaderValue(
"x_pack_rest_user",
SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING
Expand All @@ -41,6 +52,11 @@ protected Settings restClientSettings() {
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", BASIC_AUTH_VALUE).build();
}

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

public void testPipelineCRUD() throws Exception {
// put pipeline
final String pipelineJson = getPipelineJson();
Expand Down
25 changes: 21 additions & 4 deletions x-pack/plugin/slm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@

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

esplugin {
name = 'x-pack-slm'
description = 'Elasticsearch Expanded Pack Plugin - Snapshot Lifecycle Management'
classname ='org.elasticsearch.xpack.slm.SnapshotLifecycle'
classname = 'org.elasticsearch.xpack.slm.SnapshotLifecycle'
extendedPlugins = ['x-pack-core']
hasNativeController =false
requiresKeystore =true
hasNativeController = false
requiresKeystore = true
}

base {
archivesName = 'x-pack-slm'
}
Expand All @@ -26,6 +29,20 @@ dependencies {
testImplementation project(xpackModule('ccr'))
testImplementation project(xpackModule('ilm'))
testImplementation project(':modules:data-streams')
javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
javaRestTestImplementation project(xpackModule('slm'))
yamlRestTestImplementation(testArtifact(project(xpackModule('core'))))
clusterModules project(xpackModule("ilm"))
clusterModules project(xpackModule("searchable-snapshots"))
clusterModules project(":modules:data-streams")
}

restResources {
restApi {
include '_common', 'cluster', 'indices', 'index', 'snapshot', 'slm', 'health_report'
}
}

addQaCheckDependencies(project)
tasks.named("javaRestTest") {
usesDefaultDistribution("uses _xpack/usage api")
}
Empty file removed x-pack/plugin/slm/qa/build.gradle
Empty file.
43 changes: 0 additions & 43 deletions x-pack/plugin/slm/qa/multi-node/build.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions x-pack/plugin/slm/qa/rest/build.gradle

This file was deleted.

9 changes: 0 additions & 9 deletions x-pack/plugin/slm/qa/with-security/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.junit.annotations.TestIssueLogging;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xcontent.ToXContent;
Expand All @@ -35,6 +38,9 @@
import org.elasticsearch.xpack.core.slm.SnapshotLifecyclePolicy;
import org.elasticsearch.xpack.core.slm.SnapshotLifecycleStats;
import org.elasticsearch.xpack.core.slm.SnapshotRetentionConfiguration;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.TemporaryFolder;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -62,16 +68,43 @@
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;

@SuppressForbidden(reason = "TemporaryFolder uses java.io.File")
public class SnapshotLifecycleRestIT extends ESRestTestCase {
private static final String NEVER_EXECUTE_CRON_SCHEDULE = "* * * 31 FEB ? *";

public static TemporaryFolder repoDir = new TemporaryFolder();

public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
// TODO: Revert to integ-test distro once we sort out issues with usage and info xpack apis
.distribution(DistributionType.DEFAULT)
.nodes(2)
.module("x-pack-slm")
.module("x-pack-ilm")
.module("searchable-snapshots")
.module("data-streams")
.setting("path.repo", () -> repoDir.getRoot().getAbsolutePath())
.setting("xpack.security.enabled", "false")
.setting("xpack.license.self_generated.type", "trial")
.setting("xpack.searchable.snapshot.shared_cache.size", "16MB")
.setting("xpack.searchable.snapshot.shared_cache.region_size", "256KB")
.setting("indices.lifecycle.poll_interval", "1000ms")
.build();

@ClassRule
public static RuleChain rules = RuleChain.outerRule(repoDir).around(cluster);

// as we are testing the SLM history entries we'll preserve the "slm-history-ilm-policy" policy as it'll be associated with the
// .slm-history-* indices and we won't be able to delete it when we wipe out the cluster
@Override
protected boolean preserveILMPoliciesUponCompletion() {
return true;
}

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

public void testMissingRepo() throws Exception {
SnapshotLifecyclePolicy policy = new SnapshotLifecyclePolicy(
"missing-repo-policy",
Expand Down Expand Up @@ -919,7 +952,7 @@ private void initializeRepo(String repoName, String maxBytesPerSecond) throws IO
.field("type", "fs")
.startObject("settings")
.field("compress", randomBoolean())
.field("location", System.getProperty("tests.path.repo"))
.field("location", repoDir.getRoot().getAbsolutePath())
.field("max_snapshot_bytes_per_sec", maxBytesPerSecond)
.endObject()
.endObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,27 @@
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.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

import java.util.Objects;

@TimeoutSuite(millis = 30 * TimeUnits.MINUTE) // as default timeout seems not enough on the jenkins VMs
public class SnapshotLifecycleYamlIT extends ESClientYamlSuiteTestCase {

private static final String USER = Objects.requireNonNull(System.getProperty("tests.rest.cluster.username"));
private static final String PASS = Objects.requireNonNull(System.getProperty("tests.rest.cluster.password"));
private static final String USER = Objects.requireNonNull(System.getProperty("tests.rest.cluster.username", "test_admin"));
private static final String PASS = Objects.requireNonNull(System.getProperty("tests.rest.cluster.password", "x-pack-test-password"));

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("x-pack-slm")
.module("x-pack-ilm")
.setting("xpack.security.enabled", "true")
.setting("xpack.license.self_generated.type", "trial")
.user(USER, PASS)
.build();

public SnapshotLifecycleYamlIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
Expand All @@ -40,4 +51,9 @@ protected Settings restClientSettings() {
String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray()));
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", token).build();
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
35 changes: 26 additions & 9 deletions x-pack/plugin/stack/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
name = 'x-pack-stack'
description = 'Elasticsearch Expanded Pack Plugin - Stack'
classname ='org.elasticsearch.xpack.stack.StackPlugin'
classname = 'org.elasticsearch.xpack.stack.StackPlugin'
extendedPlugins = ['x-pack-core']
hasNativeController =false
requiresKeystore =true
hasNativeController = false
requiresKeystore = true
}

base {
Expand All @@ -19,16 +21,31 @@ dependencies {
testImplementation project(':modules:data-streams')
javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
javaRestTestImplementation project(path: ':x-pack:plugin:stack')
yamlRestTestImplementation(testArtifact(project(xpackModule('core'))))
clusterModules project(':modules:mapper-extras')
clusterModules project(xpackModule('wildcard'))
clusterModules project(xpackModule('ilm'))
clusterModules project(xpackModule('mapper-constant-keyword'))
clusterModules project(':modules:ingest-common')
clusterModules project(':modules:mapper-extras')
clusterModules project(':modules:data-streams')
}

restResources {
restApi {
include '_common', 'cluster', 'indices', 'index', 'snapshot', 'ilm', 'slm', 'stack', 'indices'
}
}

// These tests are only invoked direclty as part of a dedicated build job
tasks.named('javaRestTest').configure {task ->
onlyIf("E2E test task must be invoked directly") {
gradle.startParameter.getTaskNames().contains(task.path) ||
(gradle.startParameter.getTaskNames().contains(task.name) && gradle.startParameter.currentDir == project.projectDir)
}
tasks.named('javaRestTest') { task ->
onlyIf("E2E test task must be invoked directly") {
gradle.startParameter.getTaskNames().contains(task.path) ||
(gradle.startParameter.getTaskNames().contains(task.name) && gradle.startParameter.currentDir == project.projectDir)
}
}

addQaCheckDependencies(project)
tasks.named("yamlRestCompatTestTransform") { task ->
task.skipTest("stack/10_basic/Test kibana reporting index auto creation", "warning does not exist for compatibility")
task.skipTest("cat.shards/10_basic/Help", "sync_id is removed in 9.0")
}
Empty file.
Loading