diff --git a/pom.xml b/pom.xml index b20ecad75a55e..b580ca66212a8 100644 --- a/pom.xml +++ b/pom.xml @@ -42,16 +42,30 @@ governing permissions and limitations under the License. --> - 0.90.6 + 1.0.0.RC1-SNAPSHOT + 4.6.0 + onerror + 1 + true + onerror + + + INFO + + org.apache.lucene + lucene-test-framework + ${lucene.version} + test + + org.elasticsearch elasticsearch ${elasticsearch.version} - log4j log4j @@ -59,12 +73,24 @@ governing permissions and limitations under the License. --> test - junit - junit - 4.11 + org.elasticsearch + elasticsearch + ${elasticsearch.version} + test-jar + test + + + org.hamcrest + hamcrest-core + 1.3.RC2 + test + + + org.hamcrest + hamcrest-library + 1.3.RC2 test - @@ -91,10 +117,103 @@ governing permissions and limitations under the License. --> 1.6 + + com.carrotsearch.randomizedtesting + junit4-maven-plugin + 2.0.14 + + + tests + test + + junit4 + + + 20 + pipe,warn + true + + + + + + + + + ${tests.jvms} + + + + + + + **/*Tests.class + **/*Test.class + + + **/Abstract*.class + **/*StressTest.class + + + ${tests.jvm.argline} + + + -Xmx512m + -Xss256k + -XX:MaxDirectMemorySize=512m + -Des.logger.prefix= + + ${tests.shuffle} + ${tests.verbose} + ${tests.seed} + ${tests.failfast} + + + ${tests.jvm.argline} + ${tests.iters} + ${tests.maxfailures} + ${tests.failfast} + ${tests.class} + ${tests.method} + ${tests.nightly} + ${tests.badapples} + ${tests.weekly} + ${tests.slow} + ${tests.azure} + ${tests.awaitsfix} + ${tests.slow} + ${tests.timeoutSuite} + ${tests.showSuccess} + ${tests.integration} + ${tests.cluster_seed} + ${tests.client.ratio} + ${env.ES_TEST_LOCAL} + ${es.node.mode} + ${es.config} + ${es.logger.level} + true + + + + + org.apache.maven.plugins maven-surefire-plugin 2.13 + + true + org.apache.maven.plugins diff --git a/src/main/java/org/elasticsearch/cloud/azure/AzureModule.java b/src/main/java/org/elasticsearch/cloud/azure/AzureModule.java index 7582a0c436aa0..367481321f82f 100644 --- a/src/main/java/org/elasticsearch/cloud/azure/AzureModule.java +++ b/src/main/java/org/elasticsearch/cloud/azure/AzureModule.java @@ -21,23 +21,49 @@ import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.logging.ESLogger; +import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.discovery.azure.AzureDiscovery; /** + * Azure Module * + * + * + * @see org.elasticsearch.cloud.azure.AzureComputeServiceImpl */ public class AzureModule extends AbstractModule { + protected final ESLogger logger; private Settings settings; @Inject public AzureModule(Settings settings) { this.settings = settings; + this.logger = Loggers.getLogger(getClass(), settings); } @Override protected void configure() { + logger.debug("starting azure services"); + + // If we have set discovery to azure, let's start the azure compute service + if (isDiscoveryReady(settings)) { + logger.debug("starting azure discovery service"); bind(AzureComputeService.class) .to(settings.getAsClass("cloud.azure.api.impl", AzureComputeServiceImpl.class)) .asEagerSingleton(); + } + } + + /** + * Check if discovery is meant to start + * @return true if we can start discovery features + */ + public static boolean isDiscoveryReady(Settings settings) { + return (AzureDiscovery.AZURE.equalsIgnoreCase(settings.get("discovery.type"))); } } diff --git a/src/main/java/org/elasticsearch/cloud/azure/AzureSettingsFilter.java b/src/main/java/org/elasticsearch/cloud/azure/AzureSettingsFilter.java index 9728c2c253c7e..863a97874a239 100644 --- a/src/main/java/org/elasticsearch/cloud/azure/AzureSettingsFilter.java +++ b/src/main/java/org/elasticsearch/cloud/azure/AzureSettingsFilter.java @@ -23,15 +23,16 @@ import org.elasticsearch.common.settings.SettingsFilter; /** - * + * Filtering cloud.azure.* settings */ public class AzureSettingsFilter implements SettingsFilter.Filter { @Override public void filter(ImmutableSettings.Builder settings) { - settings.remove("cloud.private_key"); + // Cloud settings settings.remove("cloud.certificate"); settings.remove("cloud.azure.password"); settings.remove("cloud.azure.subscription_id"); + settings.remove("cloud.azure.service_name"); } } diff --git a/src/main/java/org/elasticsearch/discovery/azure/AzureDiscovery.java b/src/main/java/org/elasticsearch/discovery/azure/AzureDiscovery.java index 6313e15238311..c56a8632c06ed 100755 --- a/src/main/java/org/elasticsearch/discovery/azure/AzureDiscovery.java +++ b/src/main/java/org/elasticsearch/discovery/azure/AzureDiscovery.java @@ -41,6 +41,8 @@ */ public class AzureDiscovery extends ZenDiscovery { + public static final String AZURE = "azure"; + @Inject public AzureDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, NodeSettingsService nodeSettingsService, ZenPingService pingService, diff --git a/src/main/java/org/elasticsearch/discovery/azure/AzureDiscoveryModule.java b/src/main/java/org/elasticsearch/discovery/azure/AzureDiscoveryModule.java index cd46618d97943..1a51f214f4bea 100644 --- a/src/main/java/org/elasticsearch/discovery/azure/AzureDiscoveryModule.java +++ b/src/main/java/org/elasticsearch/discovery/azure/AzureDiscoveryModule.java @@ -19,6 +19,11 @@ package org.elasticsearch.discovery.azure; +import org.elasticsearch.cloud.azure.AzureModule; +import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.logging.ESLogger; +import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.discovery.Discovery; import org.elasticsearch.discovery.zen.ZenDiscoveryModule; @@ -27,8 +32,21 @@ */ public class AzureDiscoveryModule extends ZenDiscoveryModule { + protected final ESLogger logger; + private Settings settings; + + @Inject + public AzureDiscoveryModule(Settings settings) { + super(); + this.logger = Loggers.getLogger(getClass(), settings); + this.settings = settings; + } @Override protected void bindDiscovery() { + if (AzureModule.isDiscoveryReady(settings)) { bind(Discovery.class).to(AzureDiscovery.class).asEagerSingleton(); + } else { + logger.debug("disabling azure discovery features"); + } } } diff --git a/src/test/java/org/elasticsearch/azure/itest/AzureSimpleITest.java b/src/test/java/org/elasticsearch/azure/itest/AzureSimpleITest.java index 59fafbb003fdb..b96a604c32a83 100644 --- a/src/test/java/org/elasticsearch/azure/itest/AzureSimpleITest.java +++ b/src/test/java/org/elasticsearch/azure/itest/AzureSimpleITest.java @@ -18,20 +18,40 @@ */ package org.elasticsearch.azure.itest; +import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; +import org.elasticsearch.cloud.azure.AbstractAzureTest; import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.node.NodeBuilder; -import org.junit.Ignore; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.hamcrest.Matchers; import org.junit.Test; -public class AzureSimpleITest { +/** + * This test needs Azure to run and -Dtests.azure=true to be set + * and -Des.config=/path/to/elasticsearch.yml + * @see org.elasticsearch.cloud.azure.AbstractAzureTest + */ +@AbstractAzureTest.AzureTest +@ElasticsearchIntegrationTest.ClusterScope( + scope = ElasticsearchIntegrationTest.Scope.TEST, + numNodes = 1, + transportClientRatio = 0.0) +public class AzureSimpleITest extends AbstractAzureTest { - @Test @Ignore + @Test public void one_node_should_run() { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder() - //.put("gateway.type", "local") - .put("path.data", "./target/es/data") - .put("path.logs", "./target/es/logs") - .put("path.work", "./target/es/work"); - NodeBuilder.nodeBuilder().settings(builder).node(); + // Do nothing... Just start :-) + // but let's check that we have at least 1 node (local node) + ClusterStateResponse clusterState = client().admin().cluster().prepareState().execute().actionGet(); + + assertThat(clusterState.getState().getNodes().getSize(), Matchers.greaterThanOrEqualTo(1)); + } + + @Override + public Settings indexSettings() { + // During restore we frequently restore index to exactly the same state it was before, that might cause the same + // checksum file to be written twice during restore operation + return ImmutableSettings.builder().put(super.indexSettings()) + .build(); } } diff --git a/src/test/java/org/elasticsearch/azure/test/AzureAbstractTest.java b/src/test/java/org/elasticsearch/azure/test/AzureAbstractTest.java deleted file mode 100644 index c02f267d95ff4..0000000000000 --- a/src/test/java/org/elasticsearch/azure/test/AzureAbstractTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Licensed to ElasticSearch under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. ElasticSearch licenses this - * file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.azure.test; - -import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.transport.NoNodeAvailableException; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.cloud.azure.AzureComputeService; -import org.elasticsearch.common.io.FileSystemUtils; -import org.elasticsearch.common.logging.ESLogger; -import org.elasticsearch.common.logging.ESLoggerFactory; -import org.elasticsearch.common.settings.ImmutableSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; -import org.elasticsearch.node.internal.InternalNode; -import org.elasticsearch.transport.netty.NettyTransport; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -public abstract class AzureAbstractTest { - - protected static ESLogger logger = ESLoggerFactory.getLogger(AzureAbstractTest.class.getName()); - private static List nodes; - private Class mock; - - public AzureAbstractTest(Class mock) { - // We want to inject the Azure API Mock - this.mock = mock; - } - - @Before - public void setUp() { - nodes = new ArrayList(); - - File dataDir = new File("./target/es/data"); - if(dataDir.exists()) { - FileSystemUtils.deleteRecursively(dataDir, true); - } - } - - @After - public void tearDown() { - // Cleaning nodes after test - for (Node node : nodes) { - node.close(); - } - } - - protected Client getTransportClient() { - // Create a TransportClient on node 1 and 2 - Settings settings = ImmutableSettings.settingsBuilder() - .put("cluster.name", "azure") - .put("transport.tcp.connect_timeout", "1s") - .build(); - - TransportClient client = new TransportClient(settings); - - for (Node node : nodes) { - NettyTransport nettyTransport = ((InternalNode) node).injector().getInstance(NettyTransport.class); - TransportAddress transportAddress = nettyTransport.boundAddress().publishAddress(); - client.addTransportAddress(transportAddress); - } - - return client; - } - - protected Client getNodeClient() { - for (Node node : nodes) { - return node.client(); - } - - return null; - } - - protected void checkNumberOfNodes(int expected, boolean fail) { - NodesInfoResponse nodeInfos = null; - - try { - nodeInfos = getTransportClient().admin().cluster().prepareNodesInfo().execute().actionGet(); - } catch (NoNodeAvailableException e) { - // If we can't build a Transport Client, we are may be not connected to any network - // Let's try a Node Client - nodeInfos = getNodeClient().admin().cluster().prepareNodesInfo().execute().actionGet(); - } - - Assert.assertNotNull(nodeInfos); - Assert.assertNotNull(nodeInfos.getNodes()); - - if (fail) { - Assert.assertEquals(expected, nodeInfos.getNodes().length); - } else { - if (nodeInfos.getNodes().length != expected) { - logger.warn("expected {} node(s) but found {}. Could be due to no local IP address available.", - expected, nodeInfos.getNodes().length); - } - } - } - - protected void checkNumberOfNodes(int expected) { - checkNumberOfNodes(expected, true); - } - - protected void nodeBuilder() { - ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder() - //.put("gateway.type", "local") - .put("path.data", "./target/es/data") - .put("path.logs", "./target/es/logs") - .put("path.work", "./target/es/work") -// .put("discovery.zen.ping.timeout", "500ms") -// .put("discovery.zen.fd.ping_retries",1) -// .put("discovery.zen.fd.ping_timeout", "500ms") -// .put("discovery.initial_state_timeout", "5s") -// .put("transport.tcp.connect_timeout", "1s") - .put("cloud.azure.api.impl", mock) - .put("cloud.azure.refresh_interval", "5s") - .put("node.name", (nodes.size()+1) + "#" + mock.getSimpleName()); - Node node = NodeBuilder.nodeBuilder().settings(builder).node(); - nodes.add(node); - } -} diff --git a/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureTest.java b/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureTest.java new file mode 100644 index 0000000000000..58c69ebba7636 --- /dev/null +++ b/src/test/java/org/elasticsearch/cloud/azure/AbstractAzureTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to Elasticsearch (the "Author") under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Author licenses this + * file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.cloud.azure; + +import com.carrotsearch.randomizedtesting.annotations.TestGroup; +import org.elasticsearch.test.ElasticsearchIntegrationTest; + +import java.lang.annotation.Documented; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * + */ +public abstract class AbstractAzureTest extends ElasticsearchIntegrationTest { + + /** + * Annotation for tests that require Azure to run. Azure tests are disabled by default. + *

+ * To enable test add -Dtests.azure=true -Des.config=/path/to/elasticsearch.yml + *

+ * The elasticsearch.yml file should contain the following keys + *

+      cloud:
+          azure:
+              keystore: FULLPATH-TO-YOUR-KEYSTORE
+              password: YOUR-PASSWORD
+              subscription_id: YOUR-AZURE-SUBSCRIPTION-ID
+              service_name: YOUR-AZURE-SERVICE-NAME
+
+      discovery:
+              type: azure
+     * 
+ */ + @Documented + @Inherited + @Retention(RetentionPolicy.RUNTIME) + @TestGroup(enabled = false, sysProperty = SYSPROP_AZURE) + public @interface AzureTest { + } + + /** + */ + public static final String SYSPROP_AZURE = "tests.azure"; + +} diff --git a/src/test/java/org/elasticsearch/discovery/azure/AbstractAzureComputeServiceTest.java b/src/test/java/org/elasticsearch/discovery/azure/AbstractAzureComputeServiceTest.java new file mode 100644 index 0000000000000..c6586dfe1fc5a --- /dev/null +++ b/src/test/java/org/elasticsearch/discovery/azure/AbstractAzureComputeServiceTest.java @@ -0,0 +1,53 @@ +/* + * Licensed to ElasticSearch under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. ElasticSearch licenses this + * file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.elasticsearch.discovery.azure; + +import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; +import org.elasticsearch.cloud.azure.AbstractAzureTest; +import org.elasticsearch.cloud.azure.AzureComputeService; +import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.common.settings.Settings; + +public abstract class AbstractAzureComputeServiceTest extends AbstractAzureTest { + + private Class mock; + + public AbstractAzureComputeServiceTest(Class mock) { + // We want to inject the Azure API Mock + this.mock = mock; + } + + protected void checkNumberOfNodes(int expected) { + NodesInfoResponse nodeInfos = client().admin().cluster().prepareNodesInfo().execute().actionGet(); + assertNotNull(nodeInfos); + assertNotNull(nodeInfos.getNodes()); + assertEquals(expected, nodeInfos.getNodes().length); + } + + @Override + protected Settings nodeSettings(int nodeOrdinal) { + ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder() + .put("cloud.azure.api.impl", mock) + // We add a fake subscription_id to start mock compute service + .put("cloud.azure.subscription_id", "fake") + .put("cloud.azure.refresh_interval", "5s"); + + return builder.build(); + } +} diff --git a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceAbstractMock.java b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceAbstractMock.java similarity index 92% rename from src/test/java/org/elasticsearch/azure/test/AzureComputeServiceAbstractMock.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceAbstractMock.java index b04524fec989c..142923f58534e 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceAbstractMock.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceAbstractMock.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.cloud.azure.AzureComputeService; @@ -32,6 +32,7 @@ public abstract class AzureComputeServiceAbstractMock extends AbstractLifecycleC protected AzureComputeServiceAbstractMock(Settings settings) { super(settings); + logger.debug("starting Azure Mock [{}]", this.getClass().getSimpleName()); } @Override diff --git a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceSimpleMock.java b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceSimpleMock.java similarity index 94% rename from src/test/java/org/elasticsearch/azure/test/AzureComputeServiceSimpleMock.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceSimpleMock.java index f3cac7a940f89..c1b79e39c4b68 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceSimpleMock.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceSimpleMock.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; import org.elasticsearch.cloud.azure.Instance; import org.elasticsearch.common.inject.Inject; @@ -34,7 +34,6 @@ public class AzureComputeServiceSimpleMock extends AzureComputeServiceAbstractMo @Inject protected AzureComputeServiceSimpleMock(Settings settings) { super(settings); - logger.debug("starting Azure Mock"); } @Override diff --git a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceTwoNodesMock.java b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceTwoNodesMock.java similarity index 95% rename from src/test/java/org/elasticsearch/azure/test/AzureComputeServiceTwoNodesMock.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceTwoNodesMock.java index d94efc13f5435..8a60528846ac3 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureComputeServiceTwoNodesMock.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureComputeServiceTwoNodesMock.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; import org.elasticsearch.cloud.azure.Instance; import org.elasticsearch.common.inject.Inject; @@ -34,7 +34,6 @@ public class AzureComputeServiceTwoNodesMock extends AzureComputeServiceAbstract @Inject protected AzureComputeServiceTwoNodesMock(Settings settings) { super(settings); - logger.debug("starting Azure Mock"); } @Override diff --git a/src/test/java/org/elasticsearch/azure/test/AzureInstanceXmlParserTest.java b/src/test/java/org/elasticsearch/discovery/azure/AzureInstanceXmlParserTest.java similarity index 98% rename from src/test/java/org/elasticsearch/azure/test/AzureInstanceXmlParserTest.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureInstanceXmlParserTest.java index d99e3edc74b41..dfe358d3254ea 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureInstanceXmlParserTest.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureInstanceXmlParserTest.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; import org.elasticsearch.cloud.azure.AzureComputeServiceImpl; import org.elasticsearch.cloud.azure.Instance; diff --git a/src/test/java/org/elasticsearch/azure/test/AzureSimpleTest.java b/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java similarity index 76% rename from src/test/java/org/elasticsearch/azure/test/AzureSimpleTest.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java index 2fee19dac90ef..6bd7130300db1 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureSimpleTest.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureSimpleTest.java @@ -16,11 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; +import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -public class AzureSimpleTest extends AzureAbstractTest { +@ElasticsearchIntegrationTest.ClusterScope( + scope = ElasticsearchIntegrationTest.Scope.TEST, + numNodes = 1, + transportClientRatio = 0.0) +public class AzureSimpleTest extends AbstractAzureComputeServiceTest { public AzureSimpleTest() { super(AzureComputeServiceSimpleMock.class); @@ -28,10 +33,9 @@ public AzureSimpleTest() { @Test public void one_node_should_run() { - // Then we start our node for tests - nodeBuilder(); - // We expect having 2 nodes as part of the cluster, let's test that checkNumberOfNodes(1); + + } } diff --git a/src/test/java/org/elasticsearch/azure/test/AzureTwoStartedNodesTest.java b/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java similarity index 73% rename from src/test/java/org/elasticsearch/azure/test/AzureTwoStartedNodesTest.java rename to src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java index ae1e3ac8febdf..a806f5e63cd13 100644 --- a/src/test/java/org/elasticsearch/azure/test/AzureTwoStartedNodesTest.java +++ b/src/test/java/org/elasticsearch/discovery/azure/AzureTwoStartedNodesTest.java @@ -16,11 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.azure.test; +package org.elasticsearch.discovery.azure; +import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -public class AzureTwoStartedNodesTest extends AzureAbstractTest { +@ElasticsearchIntegrationTest.ClusterScope( + scope = ElasticsearchIntegrationTest.Scope.TEST, + numNodes = 2, + transportClientRatio = 0.0) +public class AzureTwoStartedNodesTest extends AbstractAzureComputeServiceTest { public AzureTwoStartedNodesTest() { super(AzureComputeServiceTwoNodesMock.class); @@ -28,11 +33,7 @@ public AzureTwoStartedNodesTest() { @Test public void two_nodes_should_run() { - // Then we start our node for tests - nodeBuilder(); - nodeBuilder(); - // We expect having 2 nodes as part of the cluster, let's test that - checkNumberOfNodes(2, false); + checkNumberOfNodes(2); } } diff --git a/src/test/resources/elasticsearch.yml b/src/test/resources/elasticsearch.yml index 82583a481cb5e..07536b8c77b7c 100644 --- a/src/test/resources/elasticsearch.yml +++ b/src/test/resources/elasticsearch.yml @@ -8,9 +8,7 @@ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the specific language # governing permissions and limitations under the License. - - cluster.name: azure - +# # Azure discovery allows to use Azure API in order to perform discovery. # # You have to install the cloud-azure plugin for enabling the Azure discovery. @@ -18,13 +16,15 @@ # See # for more information. # -# See +# See # for a step-by-step tutorial. - cloud: - azure: - keystore: FULLPATH-TO-YOUR-KEYSTORE - password: YOUR-PASSWORD - subscription_id: YOUR-AZURE-SUBSCRIPTION-ID - service_name: YOUR-AZURE-SERVICE-NAME - discovery: - type: azure +# +# cloud: +# azure: +# keystore: FULLPATH-TO-YOUR-KEYSTORE +# password: YOUR-PASSWORD +# subscription_id: YOUR-AZURE-SUBSCRIPTION-ID +# service_name: YOUR-AZURE-SERVICE-NAME +# +# discovery: +# type: azure