mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-19 04:45:07 -04:00
Convert remaining plugin projects to new test clusters framework (#125626)
This commit is contained in:
parent
009a86a0e3
commit
930b4ab995
30 changed files with 212 additions and 200 deletions
|
@ -30,18 +30,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":docs");
|
map.put(LegacyRestTestBasePlugin.class, ":docs");
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":distribution:docker");
|
map.put(LegacyRestTestBasePlugin.class, ":distribution:docker");
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":modules:reindex");
|
map.put(LegacyRestTestBasePlugin.class, ":modules:reindex");
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-icu");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-kuromoji");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-nori");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-phonetic");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-smartcn");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-stempel");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-ukrainian");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-azure-classic");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-annotated-text");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb");
|
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
|
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
|
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
|
||||||
map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search");
|
map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search");
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class BasePluginBuildPlugin implements Plugin<Project> {
|
||||||
public static final String BUNDLE_PLUGIN_TASK_NAME = "bundlePlugin";
|
public static final String BUNDLE_PLUGIN_TASK_NAME = "bundlePlugin";
|
||||||
public static final String EXPLODED_BUNDLE_PLUGIN_TASK_NAME = "explodedBundlePlugin";
|
public static final String EXPLODED_BUNDLE_PLUGIN_TASK_NAME = "explodedBundlePlugin";
|
||||||
public static final String EXPLODED_BUNDLE_CONFIG = "explodedBundleZip";
|
public static final String EXPLODED_BUNDLE_CONFIG = "explodedBundleZip";
|
||||||
|
public static final Attribute<Boolean> EXPLODED_PLUGIN_BUNDLE_ATTRIBUTE = Attribute.of("exploded-plugin-bundle", Boolean.class);
|
||||||
|
|
||||||
protected final ProviderFactory providerFactory;
|
protected final ProviderFactory providerFactory;
|
||||||
|
|
||||||
|
@ -170,6 +171,7 @@ public class BasePluginBuildPlugin implements Plugin<Project> {
|
||||||
explodedBundleZip.setCanBeResolved(false);
|
explodedBundleZip.setCanBeResolved(false);
|
||||||
explodedBundleZip.setCanBeConsumed(true);
|
explodedBundleZip.setCanBeConsumed(true);
|
||||||
explodedBundleZip.getAttributes().attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
|
explodedBundleZip.getAttributes().attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE);
|
||||||
|
explodedBundleZip.getAttributes().attribute(EXPLODED_PLUGIN_BUNDLE_ATTRIBUTE, true);
|
||||||
project.getArtifacts().add(EXPLODED_BUNDLE_CONFIG, explodedBundle);
|
project.getArtifacts().add(EXPLODED_BUNDLE_CONFIG, explodedBundle);
|
||||||
return bundle;
|
return bundle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class IcuClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class IcuClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-icu").build();
|
||||||
|
|
||||||
public IcuClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public IcuClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class IcuClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.'
|
description = 'The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class KuromojiClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class KuromojiClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-kuromoji").build();
|
||||||
|
|
||||||
public KuromojiClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public KuromojiClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class KuromojiClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch.'
|
description = 'The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class NoriClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class NoriClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-nori").build();
|
||||||
|
|
||||||
public NoriClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public NoriClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class NoriClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.'
|
description = 'The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class PhoneticClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class PhoneticClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-phonetic").build();
|
||||||
|
|
||||||
public PhoneticClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public PhoneticClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class PhoneticClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.'
|
description = 'Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class SmartCNClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class SmartCNClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-smartcn").build();
|
||||||
|
|
||||||
public SmartCNClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public SmartCNClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class SmartCNClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.'
|
description = 'The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class StempelClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class StempelClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-stempel").build();
|
||||||
|
|
||||||
public StempelClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public StempelClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class StempelClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
|
apply plugin: 'elasticsearch.yaml-rest-compat-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
description = 'The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.'
|
description = 'The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.'
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.analysis;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class UkrainianClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class UkrainianClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("analysis-ukrainian").build();
|
||||||
|
|
||||||
public UkrainianClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public UkrainianClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class UkrainianClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: 'elasticsearch.internal-testclusters'
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
allPlugins
|
allPlugins
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import org.elasticsearch.gradle.LoggedExec
|
import org.elasticsearch.gradle.LoggedExec
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
|
apply plugin: 'elasticsearch.internal-yaml-rest-test'
|
||||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
|
@ -50,14 +50,14 @@ restResources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// needed to be consistent with ssl host checking
|
|
||||||
String host = InetAddress.getLoopbackAddress().getHostAddress()
|
|
||||||
|
|
||||||
// location of keystore and files to generate it
|
|
||||||
File keystore = new File(project.buildDir, 'keystore/test-node.jks')
|
|
||||||
|
|
||||||
// generate the keystore
|
// generate the keystore
|
||||||
TaskProvider createKey = tasks.register("createKey", LoggedExec) {
|
TaskProvider createKey = tasks.register("createKey", LoggedExec) {
|
||||||
|
// needed to be consistent with ssl host checking
|
||||||
|
String host = InetAddress.getLoopbackAddress().getHostAddress()
|
||||||
|
|
||||||
|
// location of keystore and files to generate it
|
||||||
|
File keystore = project.layout.buildDirectory.file('keystore/test-node.jks').get().asFile
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
delete(keystore.parentFile)
|
delete(keystore.parentFile)
|
||||||
keystore.parentFile.mkdirs()
|
keystore.parentFile.mkdirs()
|
||||||
|
@ -76,10 +76,9 @@ TaskProvider createKey = tasks.register("createKey", LoggedExec) {
|
||||||
'-keypass', 'keypass',
|
'-keypass', 'keypass',
|
||||||
'-storepass', 'keypass'
|
'-storepass', 'keypass'
|
||||||
}
|
}
|
||||||
//no unit tests
|
|
||||||
tasks.named("test").configure { enabled = false }
|
|
||||||
// add keystore to test classpath: it expects it there
|
// add keystore to test classpath: it expects it there
|
||||||
tasks.named("processInternalClusterTestResources").configure {
|
tasks.named("processInternalClusterTestResources") {
|
||||||
from createKey
|
from createKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.discovery.azure.classic;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class DiscoveryAzureClassicClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class DiscoveryAzureClassicClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("discovery-azure-classic").build();
|
||||||
|
|
||||||
public DiscoveryAzureClassicClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public DiscoveryAzureClassicClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class DiscoveryAzureClassicClientYamlTestSuiteIT extends ESClientYamlSuit
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
|
apply plugin: 'elasticsearch.internal-yaml-rest-test'
|
||||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
|
@ -48,11 +48,6 @@ esplugin.bundleSpec.from('config/discovery-gce') {
|
||||||
into 'config'
|
into 'config'
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("check").configure {
|
|
||||||
// also execute the QA tests when testing the plugin
|
|
||||||
dependsOn 'qa:gce:check'
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("test").configure {
|
tasks.named("test").configure {
|
||||||
// this is needed for insecure plugins, remove if possible!
|
// this is needed for insecure plugins, remove if possible!
|
||||||
systemProperty 'tests.artifact', project.name
|
systemProperty 'tests.artifact', project.name
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
group = "${group}.plugins.discovery-gce.qa"
|
|
|
@ -1,64 +0,0 @@
|
||||||
/*
|
|
||||||
* 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".
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
|
||||||
import org.elasticsearch.gradle.internal.test.AntFixture
|
|
||||||
|
|
||||||
import static org.elasticsearch.gradle.PropertyNormalization.IGNORE_VALUE
|
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
|
|
||||||
|
|
||||||
final int gceNumberOfNodes = 3
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
yamlRestTestImplementation project(':plugins:discovery-gce')
|
|
||||||
}
|
|
||||||
|
|
||||||
restResources {
|
|
||||||
restApi {
|
|
||||||
include '_common', 'cluster', 'nodes'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A task to start the GCEFixture which emulates a GCE service **/
|
|
||||||
def gceFixtureProvider = tasks.register("gceFixture", AntFixture) {
|
|
||||||
def runtimeClasspath = project.sourceSets.yamlRestTest.runtimeClasspath
|
|
||||||
dependsOn runtimeClasspath
|
|
||||||
env 'CLASSPATH', "${-> runtimeClasspath.asPath}"
|
|
||||||
executable = "${buildParams.runtimeJavaHome.get()}/bin/java"
|
|
||||||
args 'org.elasticsearch.cloud.gce.GCEFixture', baseDir, "${buildDir}/testclusters/yamlRestTest-1/config/unicast_hosts.txt"
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> expansions = [
|
|
||||||
'expected_nodes': gceNumberOfNodes
|
|
||||||
]
|
|
||||||
|
|
||||||
tasks.named("processYamlRestTestResources").configure {
|
|
||||||
inputs.properties(expansions)
|
|
||||||
filter("tokens" : expansions.collectEntries {k, v -> [k, v.toString()]} /* must be a map of strings */, ReplaceTokens.class)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("yamlRestTest").configure {
|
|
||||||
dependsOn gceFixtureProvider
|
|
||||||
}
|
|
||||||
|
|
||||||
testClusters.matching { it.name == "yamlRestTest" }.configureEach {
|
|
||||||
numberOfNodes = gceNumberOfNodes
|
|
||||||
plugin ':plugins:discovery-gce'
|
|
||||||
// use gce fixture for Auth calls instead of http://metadata.google.internal
|
|
||||||
environment 'GCE_METADATA_HOST', { "http://${gceFixtureProvider.get().addressAndPort}" }, IGNORE_VALUE
|
|
||||||
// allows to configure hidden settings (`cloud.gce.host` and `cloud.gce.root_url`)
|
|
||||||
systemProperty 'es.allow_reroute_gce_settings', 'true'
|
|
||||||
|
|
||||||
setting 'discovery.seed_providers', 'gce'
|
|
||||||
// use gce fixture for metadata server calls instead of http://metadata.google.internal
|
|
||||||
setting 'cloud.gce.host', { "http://${gceFixtureProvider.get().addressAndPort}" }, IGNORE_VALUE
|
|
||||||
// use gce fixture for API calls instead of https://www.googleapis.com
|
|
||||||
setting 'cloud.gce.root_url', { "http://${gceFixtureProvider.get().addressAndPort}" }, IGNORE_VALUE
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.cloud.gce;
|
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
|
||||||
|
|
||||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
|
||||||
|
|
||||||
public class GCEDiscoveryClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
|
||||||
|
|
||||||
public GCEDiscoveryClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
|
||||||
super(testCandidate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ParametersFactory
|
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
# Integration tests for discovery-gce
|
|
||||||
setup:
|
|
||||||
- do:
|
|
||||||
cluster.health:
|
|
||||||
wait_for_status: green
|
|
||||||
wait_for_nodes: @expected_nodes@
|
|
||||||
|
|
||||||
---
|
|
||||||
"All nodes are correctly discovered":
|
|
||||||
|
|
||||||
- do:
|
|
||||||
nodes.info:
|
|
||||||
metric: [ transport ]
|
|
||||||
|
|
||||||
- match: { _nodes.total: @expected_nodes@ }
|
|
|
@ -12,11 +12,35 @@ package org.elasticsearch.discovery.gce;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
|
|
||||||
|
import org.elasticsearch.core.SuppressForbidden;
|
||||||
|
import org.elasticsearch.test.cluster.ElasticsearchCluster;
|
||||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
import org.junit.rules.RuleChain;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
@SuppressForbidden(reason = "fixtures use java.io.File based APIs")
|
||||||
public class DiscoveryGceClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class DiscoveryGceClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||||
|
|
||||||
|
public static GCEFixture gceFixture = new GCEFixture(() -> temporaryFolder.getRoot().toPath().resolve("unicast_hosts.txt"));
|
||||||
|
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
|
||||||
|
.plugin("discovery-gce")
|
||||||
|
.nodes(3)
|
||||||
|
.node(0, n -> n.withConfigDir(() -> temporaryFolder.getRoot().toPath()))
|
||||||
|
.systemProperty("es.allow_reroute_gce_settings", "true")
|
||||||
|
.environment("GCE_METADATA_HOST", () -> gceFixture.getHostAndPort())
|
||||||
|
.setting("discovery.seed_providers", "gce")
|
||||||
|
.setting("cloud.gce.host", () -> gceFixture.getAddress())
|
||||||
|
.setting("cloud.gce.root_url", () -> gceFixture.getAddress())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static RuleChain ruleChain = RuleChain.outerRule(temporaryFolder).around(gceFixture).around(cluster);
|
||||||
|
|
||||||
public DiscoveryGceClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public DiscoveryGceClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +49,9 @@ public class DiscoveryGceClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,31 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.cloud.gce;
|
package org.elasticsearch.discovery.gce;
|
||||||
|
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.path.PathTrie;
|
import org.elasticsearch.common.path.PathTrie;
|
||||||
import org.elasticsearch.core.SuppressForbidden;
|
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.rest.RestUtils;
|
import org.elasticsearch.rest.RestUtils;
|
||||||
import org.elasticsearch.test.fixture.AbstractHttpFixture;
|
import org.elasticsearch.test.fixture.AbstractHttpFixture;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
|
@ -43,24 +44,23 @@ public class GCEFixture extends AbstractHttpFixture {
|
||||||
public static final String ZONE = "test-zone";
|
public static final String ZONE = "test-zone";
|
||||||
public static final String TOKEN = "1/fFAGRNJru1FTz70BzhT3Zg";
|
public static final String TOKEN = "1/fFAGRNJru1FTz70BzhT3Zg";
|
||||||
public static final String TOKEN_TYPE = "Bearer";
|
public static final String TOKEN_TYPE = "Bearer";
|
||||||
|
private final Supplier<Path> nodes;
|
||||||
private final PathTrie<RequestHandler> handlers;
|
private final PathTrie<RequestHandler> handlers;
|
||||||
|
|
||||||
private final Path nodes;
|
public GCEFixture(Supplier<Path> nodesUriPath) {
|
||||||
|
|
||||||
private GCEFixture(final String workingDir, final String nodesUriPath) {
|
|
||||||
super(workingDir);
|
|
||||||
this.nodes = toPath(Objects.requireNonNull(nodesUriPath));
|
|
||||||
this.handlers = defaultHandlers();
|
this.handlers = defaultHandlers();
|
||||||
|
this.nodes = nodesUriPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
@Override
|
||||||
if (args == null || args.length != 2) {
|
protected void before() throws Throwable {
|
||||||
throw new IllegalArgumentException("GCEFixture <working directory> <nodes transport uri file>");
|
InetSocketAddress inetSocketAddress = resolveAddress("0.0.0.0", 0);
|
||||||
}
|
listen(inetSocketAddress, false);
|
||||||
|
}
|
||||||
|
|
||||||
final GCEFixture fixture = new GCEFixture(args[0], args[1]);
|
@Override
|
||||||
fixture.listen();
|
protected void after() {
|
||||||
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String nonAuthPath(Request request) {
|
private static String nonAuthPath(Request request) {
|
||||||
|
@ -128,30 +128,32 @@ public class GCEFixture extends AbstractHttpFixture {
|
||||||
handlers.insert(authPath(HttpGet.METHOD_NAME, "/compute/v1/projects/{project}/zones/{zone}/instances"), request -> {
|
handlers.insert(authPath(HttpGet.METHOD_NAME, "/compute/v1/projects/{project}/zones/{zone}/instances"), request -> {
|
||||||
final var items = new ArrayList<Map<String, Object>>();
|
final var items = new ArrayList<Map<String, Object>>();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (String address : Files.readAllLines(nodes)) {
|
if (Files.exists(nodes.get())) {
|
||||||
count++;
|
for (String address : Files.readAllLines(nodes.get())) {
|
||||||
items.add(
|
count++;
|
||||||
Map.of(
|
items.add(
|
||||||
"id",
|
Map.of(
|
||||||
Long.toString(9309873766405L + count),
|
"id",
|
||||||
"description",
|
Long.toString(9309873766405L + count),
|
||||||
"ES node" + count,
|
"description",
|
||||||
"name",
|
"ES node" + count,
|
||||||
"test" + count,
|
"name",
|
||||||
"kind",
|
"test" + count,
|
||||||
"compute#instance",
|
"kind",
|
||||||
"machineType",
|
"compute#instance",
|
||||||
"n1-standard-1",
|
"machineType",
|
||||||
"networkInterfaces",
|
"n1-standard-1",
|
||||||
List.of(
|
"networkInterfaces",
|
||||||
Map.of("accessConfigs", Collections.emptyList(), "name", "nic0", "network", "default", "networkIP", address)
|
List.of(
|
||||||
),
|
Map.of("accessConfigs", Collections.emptyList(), "name", "nic0", "network", "default", "networkIP", address)
|
||||||
"status",
|
),
|
||||||
"RUNNING",
|
"status",
|
||||||
"zone",
|
"RUNNING",
|
||||||
ZONE
|
"zone",
|
||||||
)
|
ZONE
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String json = Strings.toString(
|
final String json = Strings.toString(
|
||||||
|
@ -215,8 +217,11 @@ public class GCEFixture extends AbstractHttpFixture {
|
||||||
return new Response(status.getStatus(), JSON_CONTENT_TYPE, response.getBytes(UTF_8));
|
return new Response(status.getStatus(), JSON_CONTENT_TYPE, response.getBytes(UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "Paths#get is fine - we don't have environment here")
|
private static InetSocketAddress resolveAddress(String address, int port) {
|
||||||
private static Path toPath(final String dir) {
|
try {
|
||||||
return Paths.get(dir);
|
return new InetSocketAddress(InetAddress.getByName(address), port);
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
# Integration tests for Discovery GCE components
|
setup:
|
||||||
#
|
- do:
|
||||||
|
cluster.health:
|
||||||
|
wait_for_status: green
|
||||||
|
wait_for_nodes: 3
|
||||||
|
---
|
||||||
"Discovery GCE loaded":
|
"Discovery GCE loaded":
|
||||||
- skip:
|
- skip:
|
||||||
reason: "contains is a newly added assertion"
|
reason: "contains is a newly added assertion"
|
||||||
|
@ -14,3 +18,11 @@
|
||||||
nodes.info: {}
|
nodes.info: {}
|
||||||
|
|
||||||
- contains: { nodes.$master.plugins: { name: discovery-gce } }
|
- contains: { nodes.$master.plugins: { name: discovery-gce } }
|
||||||
|
---
|
||||||
|
"All nodes are correctly discovered":
|
||||||
|
|
||||||
|
- do:
|
||||||
|
nodes.info:
|
||||||
|
metric: [ transport ]
|
||||||
|
|
||||||
|
- match: { _nodes.total: 3 }
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* 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'
|
||||||
apply plugin: 'elasticsearch.internal-cluster-test'
|
apply plugin: 'elasticsearch.internal-cluster-test'
|
||||||
|
|
||||||
esplugin {
|
esplugin {
|
||||||
|
|
|
@ -12,11 +12,16 @@ package org.elasticsearch.index.store.smb;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
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.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
|
||||||
public class StoreSmbClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
public class StoreSmbClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
|
|
||||||
|
@ClassRule
|
||||||
|
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("store-smb").build();
|
||||||
|
|
||||||
public StoreSmbClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
public StoreSmbClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +30,9 @@ public class StoreSmbClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
|
||||||
public static Iterable<Object[]> parameters() throws Exception {
|
public static Iterable<Object[]> parameters() throws Exception {
|
||||||
return ESClientYamlSuiteTestCase.createParameters();
|
return ESClientYamlSuiteTestCase.createParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestRestCluster() {
|
||||||
|
return cluster.getHttpAddresses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,10 @@ public abstract class AbstractHttpFixture extends ExternalResource {
|
||||||
return "http://127.0.0.1:" + httpServer.getAddress().getPort();
|
return "http://127.0.0.1:" + httpServer.getAddress().getPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHostAndPort() {
|
||||||
|
return "127.0.0.1:" + httpServer.getAddress().getPort();
|
||||||
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface RequestHandler {
|
public interface RequestHandler {
|
||||||
Response handle(Request request) throws IOException;
|
Response handle(Request request) throws IOException;
|
||||||
|
|
Loading…
Add table
Reference in a new issue