Use ThirdParty annotation and remove duplicate test config.

See elastic/elasticsearch-parent#41
This commit is contained in:
Robert Muir 2015-05-13 22:46:49 -04:00
parent 7f65196ee8
commit e2675c3616
3 changed files with 6 additions and 107 deletions

85
pom.xml
View File

@ -51,6 +51,8 @@ governing permissions and limitations under the License. -->
<properties> <properties>
<google.gce.version>v1-rev59-1.20.0</google.gce.version> <google.gce.version>v1-rev59-1.20.0</google.gce.version>
<es.plugin.port>9300</es.plugin.port> <es.plugin.port>9300</es.plugin.port>
<!-- currently has no unit tests -->
<tests.ifNoTests>warn</tests.ifNoTests>
</properties> </properties>
<dependencies> <dependencies>
@ -133,89 +135,6 @@ governing permissions and limitations under the License. -->
<plugin> <plugin>
<groupId>com.carrotsearch.randomizedtesting</groupId> <groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>junit4-maven-plugin</artifactId> <artifactId>junit4-maven-plugin</artifactId>
<executions>
<execution>
<id>tests</id>
<phase>test</phase>
<goals>
<goal>junit4</goal>
</goals>
<configuration>
<heartbeat>20</heartbeat>
<jvmOutputAction>pipe,warn</jvmOutputAction>
<leaveTemporary>true</leaveTemporary>
<listeners>
<report-ant-xml mavenExtensions="true"
dir="${project.build.directory}/surefire-reports"/>
<report-text
showThrowable="true"
showStackTraces="true"
showOutput="${tests.output}"
showStatusOk="false"
showStatusError="true"
showStatusFailure="true"
showStatusIgnored="true"
showSuiteSummary="true"
timestamps="false"/>
<report-execution-times file="${basedir}/.local-execution-hints.log"/>
</listeners>
<assertions>
<enable/>
</assertions>
<parallelism>1</parallelism>
<balancers>
<execution-times>
<fileset dir="${basedir}" includes=".local-execution-hints.log"/>
</execution-times>
</balancers>
<includes>
<include>**/*Tests.class</include>
<include>**/*Test.class</include>
</includes>
<excludes>
<exclude>**/Abstract*.class</exclude>
<exclude>**/*StressTest.class</exclude>
</excludes>
<argLine>
${tests.jvm.argline}
</argLine>
<jvmArgs>
<param>-Xmx512m</param>
<param>-Xss256k</param>
<param>-XX:MaxDirectMemorySize=512m</param>
<param>-Des.logger.prefix=</param>
</jvmArgs>
<shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
<sysouts>${tests.verbose}</sysouts>
<seed>${tests.seed}</seed>
<haltOnFailure>${tests.failfast}</haltOnFailure>
<systemProperties>
<!-- RandomizedTesting library system properties -->
<tests.jvm.argline>${tests.jvm.argline}</tests.jvm.argline>
<tests.iters>${tests.iters}</tests.iters>
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
<tests.failfast>${tests.failfast}</tests.failfast>
<tests.class>${tests.class}</tests.class>
<tests.method>${tests.method}</tests.method>
<tests.nightly>${tests.nightly}</tests.nightly>
<tests.badapples>${tests.badapples}</tests.badapples>
<tests.weekly>${tests.weekly}</tests.weekly>
<tests.slow>${tests.slow}</tests.slow>
<tests.gce>${tests.gce}</tests.gce>
<tests.config>${tests.config}</tests.config>
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
<tests.slow>${tests.slow}</tests.slow>
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
<tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
<tests.integration>${tests.integration}</tests.integration>
<tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
<tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
<es.logger.level>${es.logger.level}</es.logger.level>
<java.awt.headless>true</java.awt.headless>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View File

@ -19,7 +19,6 @@
package org.elasticsearch.cloud.gce; package org.elasticsearch.cloud.gce;
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -27,32 +26,14 @@ import org.elasticsearch.env.Environment;
import org.elasticsearch.env.FailedToResolveConfigException; import org.elasticsearch.env.FailedToResolveConfigException;
import org.elasticsearch.plugins.PluginsService; import org.elasticsearch.plugins.PluginsService;
import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ThirdParty;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/** /**
* *
*/ */
@ThirdParty
public abstract class AbstractGceTest extends ElasticsearchIntegrationTest { public abstract class AbstractGceTest extends ElasticsearchIntegrationTest {
/**
* Annotation for tests that require GCE to run. GCE tests are disabled by default.
* See README file for details.
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@TestGroup(enabled = false, sysProperty = SYSPROP_GCE)
public @interface GceTest {
}
/**
*/
public static final String SYSPROP_GCE = "tests.gce";
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
ImmutableSettings.Builder settings = ImmutableSettings.builder() ImmutableSettings.Builder settings = ImmutableSettings.builder()
@ -67,10 +48,10 @@ public abstract class AbstractGceTest extends ElasticsearchIntegrationTest {
if (Strings.hasText(System.getProperty("tests.config"))) { if (Strings.hasText(System.getProperty("tests.config"))) {
settings.loadFromUrl(environment.resolveConfig(System.getProperty("tests.config"))); settings.loadFromUrl(environment.resolveConfig(System.getProperty("tests.config")));
} else { } else {
fail("to run integration tests, you need to set -Dtest.gce=true and -Dtests.config=/path/to/elasticsearch.yml"); throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml");
} }
} catch (FailedToResolveConfigException exception) { } catch (FailedToResolveConfigException exception) {
fail("your test configuration file is incorrect: " + System.getProperty("tests.config")); throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception);
} }
return settings.build(); return settings.build();
} }

View File

@ -35,7 +35,6 @@ import org.junit.Test;
* See https://github.com/elasticsearch/elasticsearch-cloud-gce/issues/10 * See https://github.com/elasticsearch/elasticsearch-cloud-gce/issues/10
* @see org.elasticsearch.cloud.gce.AbstractGceTest * @see org.elasticsearch.cloud.gce.AbstractGceTest
*/ */
@AbstractGceTest.GceTest
@ElasticsearchIntegrationTest.ClusterScope( @ElasticsearchIntegrationTest.ClusterScope(
scope = ElasticsearchIntegrationTest.Scope.SUITE, scope = ElasticsearchIntegrationTest.Scope.SUITE,
numDataNodes = 1, numDataNodes = 1,