Browse Source

Build: Remove duplicate runs of packaged rest tests

We currently use the full suite of packaged rest tests for each
distribution. We also used to run rest tests within core integ tests,
but this stopped working when we split out the test-framework, since the
test files are in there.

This change simplifies the code to run packaged rest tests just once,
for the integ-test-zip, and removes the unused rest tests from
test-framework. Distributions rest tests now check that all modules
were loaded.
Ryan Ernst 10 years ago
parent
commit
3d9d8bd45a

+ 11 - 1
distribution/build.gradle

@@ -42,6 +42,7 @@ buildscript {
 // this is common configuration for distributions, but we also add it here for the license check to use
 ext.dependencyFiles = project(':core').configurations.runtime.copyRecursive().exclude(module: 'slf4j-api')
 
+
 /*****************************************************************************
  *                                  Modules                                  *
  *****************************************************************************/
@@ -50,6 +51,9 @@ task buildModules(type: Copy) {
   into 'build/modules'
 } 
 
+ext.restTestExpansions = [
+  'expected.modules.count': 0,
+]
 // we create the buildModules task above so the distribution subprojects can
 // depend on it, but we don't actually configure it until projects are evaluated
 // so it can depend on the bundling of plugins (ie modules must have been configured)
@@ -64,6 +68,7 @@ project.gradle.projectsEvaluated {
     configure(subprojects.findAll { it.name != 'integ-test-zip' }) { Project distribution ->
       distribution.integTest.mustRunAfter(module.integTest)      
     }
+    restTestExpansions['expected.modules.count'] += 1
   }
 }
 
@@ -80,11 +85,16 @@ subprojects {
   apply plugin: 'elasticsearch.rest-test'
   project.integTest {
     dependsOn(project.assemble)
-    includePackaged true
+    includePackaged project.name == 'integ-test-zip'
     cluster {
       distribution = project.name
     }
   }
+  
+  processTestResources {
+    inputs.properties(project(':distribution').restTestExpansions)
+    MavenFilteringHack.filter(it, project(':distribution').restTestExpansions)
+  }
 
   /*****************************************************************************
    *                              Maven config                                 *

+ 13 - 0
distribution/deb/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yaml

@@ -0,0 +1,13 @@
+# Integration tests for distributions with modules
+#
+"Correct Modules Count":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - length:  { nodes.$master.plugins: ${expected.modules.count}  }

+ 13 - 0
distribution/rpm/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yaml

@@ -0,0 +1,13 @@
+# Integration tests for distributions with modules
+#
+"Correct Modules Count":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - length:  { nodes.$master.plugins: ${expected.modules.count}  }

+ 13 - 0
distribution/tar/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yaml

@@ -0,0 +1,13 @@
+# Integration tests for distributions with modules
+#
+"Correct Modules Count":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - length:  { nodes.$master.plugins: ${expected.modules.count}  }

+ 13 - 0
distribution/zip/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_modules.yaml

@@ -0,0 +1,13 @@
+# Integration tests for distributions with modules
+#
+"Correct Modules Count":
+    - do:
+        cluster.state: {}
+
+    # Get master node id
+    - set: { master_node: master }
+
+    - do:
+        nodes.info: {}
+
+    - length:  { nodes.$master.plugins: ${expected.modules.count}  }

+ 0 - 6
qa/smoke-test-plugins/build.gradle

@@ -21,11 +21,6 @@ import org.elasticsearch.gradle.MavenFilteringHack
 
 apply plugin: 'elasticsearch.rest-test'
 
-ext.modulesCount = 0
-project.rootProject.subprojects.findAll { it.path.startsWith(':modules:') }.each { subproj ->
-  modulesCount += 1
-}
-
 ext.pluginsCount = 0
 project.rootProject.subprojects.findAll { it.path.startsWith(':projects:') }.each { subproj ->
   integTest {
@@ -38,7 +33,6 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':projects:') }.eac
 }
 
 ext.expansions = [
-  'expected.modules.count': modulesCount,
   'expected.plugins.count': pluginsCount
 ]
 

+ 0 - 1
qa/smoke-test-plugins/src/test/resources/rest-api-spec/test/smoke_test_plugins/10_basic.yaml

@@ -10,5 +10,4 @@
     - do:
         nodes.info: {}
 
-    - length:  { nodes.$master.modules: ${expected.modules.count}  }
     - length:  { nodes.$master.plugins: ${expected.plugins.count}  }

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest0IT.java

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

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest1IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 1 */
-public class Rest1IT extends ESRestTestCase {
-    public Rest1IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(1, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest2IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 2 */
-public class Rest2IT extends ESRestTestCase {
-    public Rest2IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(2, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest3IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 3 */
-public class Rest3IT extends ESRestTestCase {
-    public Rest3IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(3, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest4IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 4 */
-public class Rest4IT extends ESRestTestCase {
-    public Rest4IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(4, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest5IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 5 */
-public class Rest5IT extends ESRestTestCase {
-    public Rest5IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(5, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest6IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 6 */
-public class Rest6IT extends ESRestTestCase {
-    public Rest6IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(6, 8);
-    }
-}

+ 0 - 38
test-framework/src/main/java/org/elasticsearch/test/rest/Rest7IT.java

@@ -1,38 +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.test.rest;
-
-import com.carrotsearch.randomizedtesting.annotations.Name;
-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
-
-import org.elasticsearch.test.rest.parser.RestTestParseException;
-
-import java.io.IOException;
-
-/** Rest API tests subset 7 */
-public class Rest7IT extends ESRestTestCase {
-    public Rest7IT(@Name("yaml") RestTestCandidate testCandidate) {
-        super(testCandidate);
-    }
-    @ParametersFactory
-    public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
-        return createParameters(7, 8);
-    }
-}