Browse Source

Added rest tests for cloud plugins

Clinton Gormley 10 years ago
parent
commit
7aac4d5417

+ 2 - 0
plugins/cloud-aws/pom.xml

@@ -17,6 +17,8 @@
     <properties>
         <amazonaws.version>1.10.0</amazonaws.version>
         <tests.jvms>1</tests.jvms>
+        <tests.rest.suite>cloud_aws</tests.rest.suite>
+        <tests.rest.load_packaged>false</tests.rest.load_packaged>
     </properties>
 
     <dependencies>

+ 14 - 0
plugins/cloud-aws/rest-api-spec/test/cloud_aws/10_basic.yaml

@@ -0,0 +1,14 @@
+# Integration tests for Cloud AWS components
+#
+"Cloud AWS loaded":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - match:  { nodes.$master.plugins.0.name: cloud-aws  }
+    - match:  { nodes.$master.plugins.0.jvm: true  }

+ 41 - 0
plugins/cloud-aws/src/test/java/org/elasticsearch/cloud/aws/CloudAWSRestIT.java

@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.aws;
+
+import com.carrotsearch.randomizedtesting.annotations.Name;
+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
+import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
+import org.elasticsearch.test.rest.RestTestCandidate;
+import org.elasticsearch.test.rest.parser.RestTestParseException;
+
+import java.io.IOException;
+
+public class CloudAWSRestIT extends ElasticsearchRestTestCase {
+
+    public CloudAWSRestIT(@Name("yaml") RestTestCandidate testCandidate) {
+        super(testCandidate);
+    }
+
+    @ParametersFactory
+    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
+        return ElasticsearchRestTestCase.createParameters(0, 1);
+    }
+}
+

+ 2 - 0
plugins/cloud-azure/pom.xml

@@ -28,6 +28,8 @@ governing permissions and limitations under the License. -->
     <properties>
         <!-- You can add any specific project property here -->
         <tests.jvms>1</tests.jvms>
+        <tests.rest.suite>cloud_azure</tests.rest.suite>
+        <tests.rest.load_packaged>false</tests.rest.load_packaged>
     </properties>
 
     <dependencies>

+ 14 - 0
plugins/cloud-azure/rest-api-spec/test/cloud_azure/10_basic.yaml

@@ -0,0 +1,14 @@
+# Integration tests for Cloud Azure components
+#
+"Cloud Azure loaded":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - match:  { nodes.$master.plugins.0.name: cloud-azure  }
+    - match:  { nodes.$master.plugins.0.jvm: true  }

+ 41 - 0
plugins/cloud-azure/src/test/java/org/elasticsearch/cloud/azure/CloudAzureRestIT.java

@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.azure;
+
+import com.carrotsearch.randomizedtesting.annotations.Name;
+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
+import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
+import org.elasticsearch.test.rest.RestTestCandidate;
+import org.elasticsearch.test.rest.parser.RestTestParseException;
+
+import java.io.IOException;
+
+public class CloudAzureRestIT extends ElasticsearchRestTestCase {
+
+    public CloudAzureRestIT(@Name("yaml") RestTestCandidate testCandidate) {
+        super(testCandidate);
+    }
+
+    @ParametersFactory
+    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
+        return ElasticsearchRestTestCase.createParameters(0, 1);
+    }
+}
+

+ 2 - 0
plugins/cloud-gce/pom.xml

@@ -31,6 +31,8 @@ governing permissions and limitations under the License. -->
         <!-- currently has no unit tests -->
         <tests.ifNoTests>warn</tests.ifNoTests>
         <tests.jvms>1</tests.jvms>
+        <tests.rest.suite>cloud_gce</tests.rest.suite>
+        <tests.rest.load_packaged>false</tests.rest.load_packaged>
     </properties>
 
     <dependencies>

+ 14 - 0
plugins/cloud-gce/rest-api-spec/test/cloud_gce/10_basic.yaml

@@ -0,0 +1,14 @@
+# Integration tests for Cloud GCE components
+#
+"Cloud GCE loaded":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - match:  { nodes.$master.plugins.0.name: cloud-gce  }
+    - match:  { nodes.$master.plugins.0.jvm: true  }

+ 41 - 0
plugins/cloud-gce/src/test/java/org/elasticsearch/cloud/gce/CloudGCERestIT.java

@@ -0,0 +1,41 @@
+/*
+ * 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.cloud.gce;
+
+import com.carrotsearch.randomizedtesting.annotations.Name;
+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
+import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
+import org.elasticsearch.test.rest.RestTestCandidate;
+import org.elasticsearch.test.rest.parser.RestTestParseException;
+
+import java.io.IOException;
+
+public class CloudGCERestIT extends ElasticsearchRestTestCase {
+
+    public CloudGCERestIT(@Name("yaml") RestTestCandidate testCandidate) {
+        super(testCandidate);
+    }
+
+    @ParametersFactory
+    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
+        return ElasticsearchRestTestCase.createParameters(0, 1);
+    }
+}
+

+ 2 - 0
plugins/pom.xml

@@ -275,12 +275,14 @@
                     <!-- required by the test framework -->
                     <include>api/info.json</include>
                     <include>api/cluster.health.json</include>
+                    <include>api/cluster.state.json</include>
                     <!-- used in plugin REST tests -->
                     <include>api/index.json</include>
                     <include>api/search.json</include>
                     <include>api/indices.analyze.json</include>
                     <include>api/indices.create.json</include>
                     <include>api/indices.refresh.json</include>
+                    <include>api/nodes.info.json</include>
                     <include>api/count.json</include>
                 </includes>
             </testResource>