mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 13:26:02 +00:00
This commit removes xpack dependencies of many xpack qa modules. (for some qa modules this will require some more work) The reason behind this change is that qa rest modules should not depend on the x-pack plugins, because the plugins are an implementation detail and the tests should only know about the rest interface and qa cluster that is being tested. Also some qa modules rely on xpack plugins and hlrc (which is a valid dependency for rest qa tests) creates a cyclic dependency and this is something that we should avoid. Also Eclipse can't handle gradle cyclic dependencies (see #41064). * don't copy xpack-core's plugin property into the test resource of qa modules. Otherwise installing security manager fails, because it tries to find the XPackPlugin class.
This commit is contained in:
parent
636b9338a6
commit
f56b2ecb37
@ -3,7 +3,7 @@
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.smoketest;
|
||||
package org.elasticsearch.xpack.watcher.support;
|
||||
|
||||
import com.fasterxml.jackson.core.io.JsonStringEncoder;
|
||||
import org.elasticsearch.common.Nullable;
|
@ -3,6 +3,13 @@
|
||||
|
||||
import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
|
||||
apply plugin: 'elasticsearch.build'
|
||||
test.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(':test:framework')
|
||||
}
|
||||
|
||||
subprojects {
|
||||
// HACK: please fix this
|
||||
// we want to add the rest api specs for xpack to qa tests, but we
|
||||
|
@ -2,8 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
||||
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
integTest {
|
||||
|
@ -18,7 +18,7 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
|
||||
@TimeoutSuite(millis = 30 * TimeUnits.MINUTE) // as default timeout seems not enough on the jenkins VMs
|
||||
public class CoreWithSecurityClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
@ -10,22 +10,12 @@ apply plugin: 'elasticsearch.standalone-test'
|
||||
test.enabled = false
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile (project(path: xpackModule('security'), configuration: 'runtime')) {
|
||||
// Need to drop the guava dependency here or we get a conflict with watcher's guava dependency.
|
||||
// This is total #$%, but the solution is to get the SAML realm (which uses guava) out of security proper
|
||||
exclude group: "com.google.guava", module: "guava"
|
||||
}
|
||||
testCompile project(path: xpackModule('watcher'), configuration: 'runtime')
|
||||
|
||||
// TODO: Remove core dependency and change tests to not use builders that are part of xpack-core.
|
||||
// Currently needed for ml tests are using the building for datafeed and job config)
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
||||
testCompile (project(path: xpackModule('security'), configuration: 'testArtifacts')) {
|
||||
// Need to drop the guava dependency here or we get a conflict with watcher's guava dependency.
|
||||
// This is total #$%, but the solution is to get the SAML realm (which uses guava) out of security proper
|
||||
exclude group: "com.google.guava", module: "guava"
|
||||
}
|
||||
|
||||
testCompile project(path: ':qa:full-cluster-restart', configuration: 'testArtifacts')
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
Closure waitWithAuth = { NodeInfo node, AntBuilder ant ->
|
||||
@ -225,11 +215,4 @@ task copyXPackRestSpec(type: Copy) {
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
|
||||
task copyXPackPluginProps(type: Copy) {
|
||||
dependsOn(copyXPackRestSpec)
|
||||
from project(xpackModule('core')).file('src/main/plugin-metadata')
|
||||
from project(xpackModule('core')).tasks.pluginProperties
|
||||
into outputDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
|
@ -13,7 +13,6 @@ import org.elasticsearch.client.ResponseException;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.ObjectPath;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.rest.action.document.RestGetAction;
|
||||
@ -22,16 +21,6 @@ import org.elasticsearch.rest.action.search.RestSearchAction;
|
||||
import org.elasticsearch.test.StreamsUtils;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.upgrades.AbstractFullClusterRestartTestCase;
|
||||
import org.elasticsearch.xpack.core.upgrade.UpgradeField;
|
||||
import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder;
|
||||
import org.elasticsearch.xpack.security.support.SecurityIndexManager;
|
||||
import org.elasticsearch.xpack.watcher.actions.index.IndexAction;
|
||||
import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
|
||||
import org.elasticsearch.xpack.watcher.common.text.TextTemplate;
|
||||
import org.elasticsearch.xpack.watcher.condition.InternalAlwaysCondition;
|
||||
import org.elasticsearch.xpack.watcher.support.search.WatcherSearchTemplateRequest;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -61,6 +50,15 @@ import static org.hamcrest.Matchers.startsWith;
|
||||
|
||||
public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
|
||||
public static final String INDEX_ACTION_TYPES_DEPRECATION_MESSAGE =
|
||||
"[types removal] Specifying types in a watcher index action is deprecated.";
|
||||
|
||||
public static final String SEARCH_INPUT_TYPES_DEPRECATION_MESSAGE =
|
||||
"[types removal] Specifying types in a watcher search request is deprecated.";
|
||||
|
||||
public static final int UPGRADE_FIELD_EXPECTED_INDEX_FORMAT_VERSION = 6;
|
||||
public static final int SECURITY_EXPECTED_INDEX_FORMAT_VERSION = 6;
|
||||
|
||||
private String type;
|
||||
|
||||
@Before
|
||||
@ -123,7 +121,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
if (settingsMap.containsKey("index")) {
|
||||
@SuppressWarnings("unchecked")
|
||||
int format = Integer.parseInt(String.valueOf(((Map<String, Object>)settingsMap.get("index")).get("format")));
|
||||
assertEquals("The security index needs to be upgraded", SecurityIndexManager.INTERNAL_INDEX_FORMAT, format);
|
||||
assertEquals("The security index needs to be upgraded", SECURITY_EXPECTED_INDEX_FORMAT_VERSION, format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,8 +142,8 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
Request createBwcWatch = new Request("PUT", getWatcherEndpoint() + "/watch/bwc_watch");
|
||||
Request createBwcThrottlePeriod = new Request("PUT", getWatcherEndpoint() + "/watch/bwc_throttle_period");
|
||||
if (getOldClusterVersion().onOrAfter(Version.V_7_0_0)) {
|
||||
createBwcWatch.setOptions(expectWarnings(IndexAction.TYPES_DEPRECATION_MESSAGE));
|
||||
createBwcThrottlePeriod.setOptions(expectWarnings(IndexAction.TYPES_DEPRECATION_MESSAGE));
|
||||
createBwcWatch.setOptions(expectWarnings(INDEX_ACTION_TYPES_DEPRECATION_MESSAGE));
|
||||
createBwcThrottlePeriod.setOptions(expectWarnings(INDEX_ACTION_TYPES_DEPRECATION_MESSAGE));
|
||||
}
|
||||
createBwcWatch.setJsonEntity(loadWatch("simple-watch.json"));
|
||||
client().performRequest(createBwcWatch);
|
||||
@ -183,7 +181,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
logger.info("settings map {}", settingsMap);
|
||||
if (settingsMap.containsKey("index")) {
|
||||
int format = Integer.parseInt(String.valueOf(((Map<String, Object>)settingsMap.get("index")).get("format")));
|
||||
assertEquals("The watches index needs to be upgraded", UpgradeField.EXPECTED_INDEX_FORMAT_VERSION, format);
|
||||
assertEquals("The watches index needs to be upgraded", UPGRADE_FIELD_EXPECTED_INDEX_FORMAT_VERSION, format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,14 +448,14 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
if (getOldClusterVersion().before(Version.V_7_0_0)) {
|
||||
getRequest.setOptions(
|
||||
expectWarnings(
|
||||
IndexAction.TYPES_DEPRECATION_MESSAGE,
|
||||
WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE
|
||||
INDEX_ACTION_TYPES_DEPRECATION_MESSAGE,
|
||||
SEARCH_INPUT_TYPES_DEPRECATION_MESSAGE
|
||||
)
|
||||
);
|
||||
} else {
|
||||
getRequest.setOptions(
|
||||
expectWarnings(
|
||||
IndexAction.TYPES_DEPRECATION_MESSAGE
|
||||
INDEX_ACTION_TYPES_DEPRECATION_MESSAGE
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -480,14 +478,14 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
if (getOldClusterVersion().before(Version.V_7_0_0)) {
|
||||
getRequest.setOptions(
|
||||
expectWarnings(
|
||||
IndexAction.TYPES_DEPRECATION_MESSAGE,
|
||||
WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE
|
||||
INDEX_ACTION_TYPES_DEPRECATION_MESSAGE,
|
||||
SEARCH_INPUT_TYPES_DEPRECATION_MESSAGE
|
||||
)
|
||||
);
|
||||
} else {
|
||||
getRequest.setOptions(
|
||||
expectWarnings(
|
||||
IndexAction.TYPES_DEPRECATION_MESSAGE
|
||||
INDEX_ACTION_TYPES_DEPRECATION_MESSAGE
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -529,10 +527,9 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
||||
|
||||
private void assertBasicWatchInteractions() throws Exception {
|
||||
|
||||
String watch = new WatchSourceBuilder()
|
||||
.condition(InternalAlwaysCondition.INSTANCE)
|
||||
.trigger(ScheduleTrigger.builder(new IntervalSchedule(IntervalSchedule.Interval.seconds(1))))
|
||||
.addAction("awesome", LoggingAction.builder(new TextTemplate("test"))).buildAsBytes(XContentType.JSON).utf8ToString();
|
||||
String watch = "{\"trigger\":{\"schedule\":{\"interval\":\"1s\"}},\"input\":{\"none\":{}}," +
|
||||
"\"condition\":{\"always\":{}}," +
|
||||
"\"actions\":{\"awesome\":{\"logging\":{\"level\":\"info\",\"text\":\"test\"}}}}";
|
||||
Request createWatchRequest = new Request("PUT", "_watcher/watch/new_watch");
|
||||
createWatchRequest.setJsonEntity(watch);
|
||||
Map<String, Object> createWatch = entityAsMap(client().performRequest(createWatchRequest));
|
||||
|
@ -24,6 +24,7 @@ import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig;
|
||||
import org.elasticsearch.xpack.core.ml.job.config.DataDescription;
|
||||
import org.elasticsearch.xpack.core.ml.job.config.Detector;
|
||||
import org.elasticsearch.xpack.core.ml.job.config.Job;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -56,14 +57,13 @@ public class MlMigrationFullClusterRestartIT extends AbstractFullClusterRestartT
|
||||
|
||||
@Before
|
||||
public void waitForMlTemplates() throws Exception {
|
||||
List<String> templatesToWaitFor = XPackRestTestHelper.ML_POST_V660_TEMPLATES;
|
||||
List<String> templatesToWaitFor = XPackRestTestConstants.ML_POST_V660_TEMPLATES;
|
||||
|
||||
// If upgrading from a version prior to v6.6.0 the set of templates
|
||||
// to wait for is different
|
||||
if (isRunningAgainstOldCluster() && getOldClusterVersion().before(Version.V_6_6_0) ) {
|
||||
templatesToWaitFor = XPackRestTestHelper.ML_PRE_V660_TEMPLATES;
|
||||
templatesToWaitFor = XPackRestTestConstants.ML_PRE_V660_TEMPLATES;
|
||||
}
|
||||
|
||||
XPackRestTestHelper.waitForTemplates(client(), templatesToWaitFor);
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
task remoteClusterTest(type: RestIntegTestTask) {
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
|
||||
public class MultiClusterSearchWithSecurityYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
||||
|
@ -2,7 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
|
@ -16,7 +16,7 @@ import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class GlobalCheckpointSyncActionIT extends ESRestTestCase {
|
||||
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.isOneOf;
|
||||
|
||||
|
@ -4,9 +4,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') // to be moved in a later commit
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
// This is a top level task which we will add dependencies to below.
|
||||
@ -143,14 +141,7 @@ task copyXPackRestSpec(type: Copy) {
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
|
||||
task copyXPackPluginProps(type: Copy) {
|
||||
dependsOn(copyXPackRestSpec)
|
||||
from project(xpackModule('core')).file('src/main/plugin-metadata')
|
||||
from project(xpackModule('core')).tasks.pluginProperties
|
||||
into outputDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
@ -4,9 +4,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
|
||||
apply plugin: 'elasticsearch.standalone-test'
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') // to be moved in a later commit
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
// This is a top level task which we will add dependencies to below.
|
||||
|
@ -10,10 +10,7 @@ apply plugin: 'elasticsearch.standalone-test'
|
||||
test.enabled = false
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('security'), configuration: 'runtime')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts') // to be moved in a later commit
|
||||
testCompile project(':x-pack:qa')
|
||||
testCompile ("org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}")
|
||||
}
|
||||
|
||||
@ -298,11 +295,4 @@ task copyXPackRestSpec(type: Copy) {
|
||||
include 'rest-api-spec/api/**'
|
||||
into project.sourceSets.test.output.resourcesDir
|
||||
}
|
||||
|
||||
task copyXPackPluginProps(type: Copy) {
|
||||
dependsOn(copyXPackRestSpec)
|
||||
from project(xpackModule('core')).file('src/main/plugin-metadata')
|
||||
from project(xpackModule('core')).tasks.pluginProperties
|
||||
into outputDir
|
||||
}
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackPluginProps)
|
||||
project.sourceSets.test.output.dir(outputDir, builtBy: copyXPackRestSpec)
|
||||
|
@ -8,7 +8,7 @@ package org.elasticsearch.upgrades;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.SecuritySettingsSourceField;
|
||||
import org.elasticsearch.xpack.test.SecuritySettingsSourceField;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -16,12 +16,12 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
|
||||
public abstract class AbstractUpgradeTestCase extends ESRestTestCase {
|
||||
|
||||
private static final String BASIC_AUTH_VALUE =
|
||||
basicAuthHeaderValue("test_user", SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING);
|
||||
basicAuthHeaderValue("test_user", SecuritySettingsSourceField.TEST_PASSWORD);
|
||||
|
||||
@Override
|
||||
protected boolean preserveIndicesUponCompletion() {
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.client.ml.job.config.Detector;
|
||||
import org.elasticsearch.client.ml.job.config.Job;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -30,7 +30,7 @@ public class MlMappingsUpgradeIT extends AbstractUpgradeTestCase {
|
||||
|
||||
@Override
|
||||
protected Collection<String> templatesToWaitFor() {
|
||||
return Stream.concat(XPackRestTestHelper.ML_POST_V660_TEMPLATES.stream(),
|
||||
return Stream.concat(XPackRestTestConstants.ML_POST_V660_TEMPLATES.stream(),
|
||||
super.templatesToWaitFor().stream()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class MlMappingsUpgradeIT extends AbstractUpgradeTestCase {
|
||||
private void assertUpgradedMappings() throws Exception {
|
||||
|
||||
assertBusy(() -> {
|
||||
Request getMappings = new Request("GET", AnomalyDetectorsIndex.resultsWriteAlias(JOB_ID) + "/_mappings");
|
||||
Request getMappings = new Request("GET", XPackRestTestHelper.resultsWriteAlias(JOB_ID) + "/_mappings");
|
||||
Response response = client().performRequest(getMappings);
|
||||
|
||||
Map<String, Object> responseLevel = entityAsMap(response);
|
||||
|
@ -13,6 +13,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestHelper;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -28,7 +29,7 @@ public class UpgradeClusterClientYamlTestSuiteIT extends ESClientYamlSuiteTestCa
|
||||
*/
|
||||
@Before
|
||||
public void waitForTemplates() throws Exception {
|
||||
XPackRestTestHelper.waitForTemplates(client(), XPackRestTestHelper.ML_POST_V660_TEMPLATES);
|
||||
XPackRestTestHelper.waitForTemplates(client(), XPackRestTestConstants.ML_POST_V660_TEMPLATES);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,10 +6,7 @@ apply plugin: 'elasticsearch.rest-test'
|
||||
apply plugin: 'elasticsearch.test.fixtures'
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
||||
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
|
||||
testCompile 'com.google.jimfs:jimfs:1.1'
|
||||
}
|
||||
testFixtures.useFixture ":x-pack:test:idp-fixture"
|
||||
@ -103,9 +100,7 @@ thirdPartyAudit {
|
||||
'com.google.common.cache.Striped64$1',
|
||||
'com.google.common.cache.Striped64$Cell',
|
||||
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator',
|
||||
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1',
|
||||
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper',
|
||||
'com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1'
|
||||
'com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator$1'
|
||||
)
|
||||
|
||||
ignoreMissingClasses (
|
||||
|
@ -2,9 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
||||
testCompile project(path: xpackModule('watcher'))
|
||||
testCompile project(path: xpackModule('monitoring'))
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
|
@ -9,28 +9,32 @@ import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||
import org.elasticsearch.xpack.monitoring.exporter.ClusterAlertsUtil;
|
||||
import org.elasticsearch.xpack.watcher.actions.ActionBuilders;
|
||||
import org.elasticsearch.xpack.watcher.client.WatchSourceBuilders;
|
||||
import org.elasticsearch.xpack.watcher.trigger.TriggerBuilders;
|
||||
import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule;
|
||||
import org.junit.After;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.xpack.watcher.input.InputBuilders.simpleInput;
|
||||
import static org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule.Interval.Unit.MINUTES;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
@TestLogging("org.elasticsearch.client:TRACE,tracer:TRACE")
|
||||
@AwaitsFix(bugUrl = "flaky tests")
|
||||
public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
||||
|
||||
/**
|
||||
* An unsorted list of Watch IDs representing resource files for Monitoring Cluster Alerts.
|
||||
*/
|
||||
public static final String[] WATCH_IDS = {
|
||||
"elasticsearch_cluster_status",
|
||||
"elasticsearch_version_mismatch",
|
||||
"kibana_version_mismatch",
|
||||
"logstash_version_mismatch",
|
||||
"xpack_license_expiration",
|
||||
"elasticsearch_nodes",
|
||||
};
|
||||
|
||||
@After
|
||||
public void cleanExporters() throws Exception {
|
||||
Request request = new Request("PUT", "/_cluster/settings");
|
||||
@ -53,7 +57,7 @@ public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
||||
.endObject().endObject()));
|
||||
adminClient().performRequest(request);
|
||||
|
||||
assertTotalWatchCount(ClusterAlertsUtil.WATCH_IDS.length);
|
||||
assertTotalWatchCount(WATCH_IDS.length);
|
||||
|
||||
assertMonitoringWatchHasBeenOverWritten(watchId);
|
||||
}
|
||||
@ -71,7 +75,7 @@ public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
||||
.endObject().endObject()));
|
||||
adminClient().performRequest(request);
|
||||
|
||||
assertTotalWatchCount(ClusterAlertsUtil.WATCH_IDS.length);
|
||||
assertTotalWatchCount(WATCH_IDS.length);
|
||||
|
||||
assertMonitoringWatchHasBeenOverWritten(watchId);
|
||||
}
|
||||
@ -95,11 +99,10 @@ public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
||||
String clusterUUID = getClusterUUID();
|
||||
String watchId = clusterUUID + "_kibana_version_mismatch";
|
||||
Request request = new Request("PUT", "/_watcher/watch/" + watchId);
|
||||
request.setJsonEntity(WatchSourceBuilders.watchBuilder()
|
||||
.trigger(TriggerBuilders.schedule(new IntervalSchedule(new IntervalSchedule.Interval(1000, MINUTES))))
|
||||
.input(simpleInput())
|
||||
.addAction("logme", ActionBuilders.loggingAction("foo"))
|
||||
.buildAsBytes(XContentType.JSON).utf8ToString());
|
||||
String watch = "{\"trigger\":{\"schedule\":{\"interval\":\"1000m\"}},\"input\":{\"simple\":{}}," +
|
||||
"\"condition\":{\"always\":{}}," +
|
||||
"\"actions\":{\"logme\":{\"logging\":{\"level\":\"info\",\"text\":\"foo\"}}}}";
|
||||
request.setJsonEntity(watch);
|
||||
client().performRequest(request);
|
||||
return watchId;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
ext.pluginsCount = 0
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
|
||||
public class XSmokeTestPluginsClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
||||
|
@ -2,10 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
// "org.elasticsearch.plugin:x-pack-core:${version}" doesn't work with idea because the testArtifacts are also here
|
||||
testCompile project(path: xpackModule('core'), configuration: 'default')
|
||||
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
||||
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
|
||||
public class SmokeTestSecurityWithMustacheClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
|
||||
|
@ -2,7 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
// bring in watcher rest test suite
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -23,7 +23,7 @@ import java.util.Collections;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class SmokeTestWatcherWithSecurityClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||
@ -76,7 +76,7 @@ public class SmokeTestWatcherWithSecurityClientYamlTestSuiteIT extends ESClientY
|
||||
});
|
||||
|
||||
assertBusy(() -> {
|
||||
for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES_NO_ILM) {
|
||||
for (String template : XPackRestTestConstants.TEMPLATE_NAMES_NO_ILM) {
|
||||
ClientYamlTestResponse templateExistsResponse = getAdminExecutionContext().callApi("indices.exists_template",
|
||||
singletonMap("name", template), emptyList(), emptyMap());
|
||||
assertThat(templateExistsResponse.getStatusCode(), is(200));
|
||||
|
@ -16,7 +16,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||
import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.hasEntry;
|
||||
@ -83,7 +83,7 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase {
|
||||
});
|
||||
|
||||
assertBusy(() -> {
|
||||
for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES) {
|
||||
for (String template : XPackRestTestConstants.TEMPLATE_NAMES) {
|
||||
assertOK(adminClient().performRequest(new Request("HEAD", "_template/" + template)));
|
||||
}
|
||||
});
|
||||
|
@ -2,10 +2,7 @@ apply plugin: 'elasticsearch.standalone-rest-test'
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
dependencies {
|
||||
testCompile "org.elasticsearch.plugin:x-pack-core:${version}"
|
||||
testCompile project(path: xpackModule('watcher'), configuration: 'runtime')
|
||||
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
|
||||
testCompile project(path: ':modules:lang-painless', configuration: 'runtime')
|
||||
testCompile project(':x-pack:qa')
|
||||
}
|
||||
|
||||
integTestCluster {
|
||||
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.yaml.ObjectPath;
|
||||
import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
|
||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.hasEntry;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
@ -63,7 +63,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
||||
});
|
||||
|
||||
assertBusy(() -> {
|
||||
for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES_NO_ILM) {
|
||||
for (String template : XPackRestTestConstants.TEMPLATE_NAMES_NO_ILM) {
|
||||
Response templateExistsResponse = adminClient().performRequest(new Request("HEAD", "/_template/" + template));
|
||||
assertThat(templateExistsResponse.getStatusLine().getStatusCode(), is(200));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
|
||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||
import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField;
|
||||
import org.elasticsearch.xpack.test.rest.XPackRestTestConstants;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -58,7 +58,7 @@ public class WatcherRestIT extends ESClientYamlSuiteTestCase {
|
||||
});
|
||||
|
||||
assertBusy(() -> {
|
||||
for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES_NO_ILM) {
|
||||
for (String template : XPackRestTestConstants.TEMPLATE_NAMES_NO_ILM) {
|
||||
ClientYamlTestResponse templateExistsResponse = getAdminExecutionContext().callApi("indices.exists_template",
|
||||
singletonMap("name", template), emptyList(), emptyMap());
|
||||
assertThat(templateExistsResponse.getStatusCode(), is(200));
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.test;
|
||||
|
||||
import org.elasticsearch.common.CharArrays;
|
||||
import org.elasticsearch.common.settings.SecureString;
|
||||
|
||||
import java.nio.CharBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
|
||||
public final class SecuritySettingsSourceField {
|
||||
public static final SecureString TEST_PASSWORD_SECURE_STRING = new SecureString("x-pack-test-password".toCharArray());
|
||||
public static final String TEST_PASSWORD = "x-pack-test-password";
|
||||
|
||||
private SecuritySettingsSourceField() {}
|
||||
|
||||
public static String basicAuthHeaderValue(String username, String passwd) {
|
||||
return basicAuthHeaderValue(username, new SecureString(passwd.toCharArray()));
|
||||
}
|
||||
|
||||
public static String basicAuthHeaderValue(String username, SecureString passwd) {
|
||||
CharBuffer chars = CharBuffer.allocate(username.length() + passwd.length() + 1);
|
||||
byte[] charBytes = null;
|
||||
try {
|
||||
chars.put(username).put(':').put(passwd.getChars());
|
||||
charBytes = CharArrays.toUtf8Bytes(chars.array());
|
||||
|
||||
//TODO we still have passwords in Strings in headers. Maybe we can look into using a CharSequence?
|
||||
String basicToken = Base64.getEncoder().encodeToString(charBytes);
|
||||
return "Basic " + basicToken;
|
||||
} finally {
|
||||
Arrays.fill(chars.array(), (char) 0);
|
||||
if (charBytes != null) {
|
||||
Arrays.fill(charBytes, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.test.rest;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class XPackRestTestConstants {
|
||||
|
||||
// Watcher constants:
|
||||
public static final String INDEX_TEMPLATE_VERSION = "9";
|
||||
public static final String HISTORY_TEMPLATE_NAME = ".watch-history-" + INDEX_TEMPLATE_VERSION;
|
||||
public static final String HISTORY_TEMPLATE_NAME_NO_ILM = ".watch-history-no-ilm-" + INDEX_TEMPLATE_VERSION;
|
||||
public static final String TRIGGERED_TEMPLATE_NAME = ".triggered_watches";
|
||||
public static final String WATCHES_TEMPLATE_NAME = ".watches";
|
||||
public static final String[] TEMPLATE_NAMES = new String[] {
|
||||
HISTORY_TEMPLATE_NAME, TRIGGERED_TEMPLATE_NAME, WATCHES_TEMPLATE_NAME
|
||||
};
|
||||
public static final String[] TEMPLATE_NAMES_NO_ILM = new String[] {
|
||||
HISTORY_TEMPLATE_NAME_NO_ILM, TRIGGERED_TEMPLATE_NAME, WATCHES_TEMPLATE_NAME
|
||||
};
|
||||
|
||||
// ML constants:
|
||||
public static final String ML_META_INDEX_NAME = ".ml-meta";
|
||||
public static final String AUDITOR_NOTIFICATIONS_INDEX = ".ml-notifications";
|
||||
public static final String CONFIG_INDEX = ".ml-config";
|
||||
public static final String RESULTS_INDEX_PREFIX = ".ml-anomalies-";
|
||||
public static final String STATE_INDEX_PREFIX = ".ml-state";
|
||||
public static final String RESULTS_INDEX_DEFAULT = "shared";
|
||||
|
||||
public static final List<String> ML_PRE_V660_TEMPLATES = Collections.unmodifiableList(Arrays.asList(
|
||||
AUDITOR_NOTIFICATIONS_INDEX, ML_META_INDEX_NAME, STATE_INDEX_PREFIX, RESULTS_INDEX_PREFIX));
|
||||
|
||||
public static final List<String> ML_POST_V660_TEMPLATES = Collections.unmodifiableList(Arrays.asList(
|
||||
AUDITOR_NOTIFICATIONS_INDEX, ML_META_INDEX_NAME, STATE_INDEX_PREFIX, RESULTS_INDEX_PREFIX, CONFIG_INDEX));
|
||||
|
||||
private XPackRestTestConstants() {
|
||||
}
|
||||
}
|
@ -14,14 +14,8 @@ import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
|
||||
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFields;
|
||||
import org.elasticsearch.xpack.core.ml.notifications.AuditorField;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@ -30,19 +24,6 @@ import static org.elasticsearch.test.rest.ESRestTestCase.allowTypesRemovalWarnin
|
||||
|
||||
public final class XPackRestTestHelper {
|
||||
|
||||
public static final List<String> ML_PRE_V660_TEMPLATES = Collections.unmodifiableList(
|
||||
Arrays.asList(AuditorField.NOTIFICATIONS_INDEX,
|
||||
MlMetaIndex.INDEX_NAME,
|
||||
AnomalyDetectorsIndexFields.STATE_INDEX_PREFIX,
|
||||
AnomalyDetectorsIndex.jobResultsIndexPrefix()));
|
||||
|
||||
public static final List<String> ML_POST_V660_TEMPLATES = Collections.unmodifiableList(
|
||||
Arrays.asList(AuditorField.NOTIFICATIONS_INDEX,
|
||||
MlMetaIndex.INDEX_NAME,
|
||||
AnomalyDetectorsIndexFields.STATE_INDEX_PREFIX,
|
||||
AnomalyDetectorsIndex.jobResultsIndexPrefix(),
|
||||
AnomalyDetectorsIndex.configIndexName()));
|
||||
|
||||
private XPackRestTestHelper() {
|
||||
}
|
||||
|
||||
@ -95,4 +76,10 @@ public final class XPackRestTestHelper {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static String resultsWriteAlias(String jobId) {
|
||||
// ".write" rather than simply "write" to avoid the danger of clashing
|
||||
// with the read alias of a job whose name begins with "write-"
|
||||
return XPackRestTestConstants.RESULTS_INDEX_PREFIX + ".write-" + jobId;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user