Skip to content

Commit 2f00ebb

Browse files
committed
Use ThirdParty annotation and remove duplicate test config.
See elastic/elasticsearch-parent#41
1 parent c1f25b0 commit 2f00ebb

File tree

5 files changed

+10
-108
lines changed

5 files changed

+10
-108
lines changed

pom.xml

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -101,89 +101,6 @@
101101
<plugin>
102102
<groupId>com.carrotsearch.randomizedtesting</groupId>
103103
<artifactId>junit4-maven-plugin</artifactId>
104-
<executions>
105-
<execution>
106-
<id>tests</id>
107-
<phase>test</phase>
108-
<goals>
109-
<goal>junit4</goal>
110-
</goals>
111-
<configuration>
112-
<heartbeat>20</heartbeat>
113-
<jvmOutputAction>pipe,warn</jvmOutputAction>
114-
<leaveTemporary>true</leaveTemporary>
115-
<listeners>
116-
<report-ant-xml mavenExtensions="true"
117-
dir="${project.build.directory}/surefire-reports"/>
118-
<report-text
119-
showThrowable="true"
120-
showStackTraces="true"
121-
showOutput="${tests.output}"
122-
showStatusOk="false"
123-
showStatusError="true"
124-
showStatusFailure="true"
125-
showStatusIgnored="true"
126-
showSuiteSummary="true"
127-
timestamps="false"/>
128-
<report-execution-times file="${basedir}/.local-execution-hints.log"/>
129-
</listeners>
130-
<assertions>
131-
<enable/>
132-
</assertions>
133-
<parallelism>1</parallelism>
134-
<balancers>
135-
<execution-times>
136-
<fileset dir="${basedir}" includes=".local-execution-hints.log"/>
137-
</execution-times>
138-
</balancers>
139-
<includes>
140-
<include>**/*Tests.class</include>
141-
<include>**/*Test.class</include>
142-
</includes>
143-
<excludes>
144-
<exclude>**/Abstract*.class</exclude>
145-
<exclude>**/*StressTest.class</exclude>
146-
</excludes>
147-
<argLine>
148-
${tests.jvm.argline}
149-
</argLine>
150-
<jvmArgs>
151-
<param>-Xmx512m</param>
152-
<param>-Xss256k</param>
153-
<param>-XX:MaxDirectMemorySize=512m</param>
154-
<param>-Des.logger.prefix=</param>
155-
</jvmArgs>
156-
<shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
157-
<sysouts>${tests.verbose}</sysouts>
158-
<seed>${tests.seed}</seed>
159-
<haltOnFailure>${tests.failfast}</haltOnFailure>
160-
<systemProperties>
161-
<!-- RandomizedTesting library system properties -->
162-
<tests.jvm.argline>${tests.jvm.argline}</tests.jvm.argline>
163-
<tests.iters>${tests.iters}</tests.iters>
164-
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
165-
<tests.failfast>${tests.failfast}</tests.failfast>
166-
<tests.class>${tests.class}</tests.class>
167-
<tests.method>${tests.method}</tests.method>
168-
<tests.nightly>${tests.nightly}</tests.nightly>
169-
<tests.badapples>${tests.badapples}</tests.badapples>
170-
<tests.weekly>${tests.weekly}</tests.weekly>
171-
<tests.slow>${tests.slow}</tests.slow>
172-
<tests.aws>${tests.aws}</tests.aws>
173-
<tests.config>${tests.config}</tests.config>
174-
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
175-
<tests.slow>${tests.slow}</tests.slow>
176-
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
177-
<tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
178-
<tests.integration>${tests.integration}</tests.integration>
179-
<tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
180-
<tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
181-
<es.logger.level>${es.logger.level}</es.logger.level>
182-
<java.awt.headless>true</java.awt.headless>
183-
</systemProperties>
184-
</configuration>
185-
</execution>
186-
</executions>
187104
</plugin>
188105
<plugin>
189106
<groupId>org.apache.maven.plugins</groupId>

src/test/java/org/elasticsearch/cloud/aws/AbstractAwsTest.java

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
package org.elasticsearch.cloud.aws;
2121

2222
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
23+
2324
import org.elasticsearch.common.Strings;
2425
import org.elasticsearch.common.settings.ImmutableSettings;
2526
import org.elasticsearch.common.settings.Settings;
2627
import org.elasticsearch.env.Environment;
2728
import org.elasticsearch.env.FailedToResolveConfigException;
2829
import org.elasticsearch.plugins.PluginsService;
2930
import org.elasticsearch.test.ElasticsearchIntegrationTest;
31+
import org.elasticsearch.test.ElasticsearchIntegrationTest.ThirdParty;
3032
import org.junit.After;
3133
import org.junit.Before;
3234

@@ -38,8 +40,12 @@
3840
import java.util.Map;
3941

4042
/**
41-
*
43+
* Base class for AWS tests that require credentials.
44+
* <p>
45+
* You must specify {@code -Dtests.thirdparty=true -Dtests.config=/path/to/config}
46+
* in order to run these tests.
4247
*/
48+
@ThirdParty
4349
public abstract class AbstractAwsTest extends ElasticsearchIntegrationTest {
4450

4551
/**
@@ -71,22 +77,6 @@ public void restoreProperties() {
7177
}
7278
}
7379

74-
75-
/**
76-
* Annotation for tests that require AWS to run. AWS tests are disabled by default.
77-
* Look at README file for details on how to run tests
78-
*/
79-
@Documented
80-
@Inherited
81-
@Retention(RetentionPolicy.RUNTIME)
82-
@TestGroup(enabled = false, sysProperty = SYSPROP_AWS)
83-
public @interface AwsTest {
84-
}
85-
86-
/**
87-
*/
88-
public static final String SYSPROP_AWS = "tests.aws";
89-
9080
@Override
9181
protected Settings nodeSettings(int nodeOrdinal) {
9282
ImmutableSettings.Builder settings = ImmutableSettings.builder()
@@ -105,10 +95,10 @@ protected Settings nodeSettings(int nodeOrdinal) {
10595
if (Strings.hasText(System.getProperty("tests.config"))) {
10696
settings.loadFromUrl(environment.resolveConfig(System.getProperty("tests.config")));
10797
} else {
108-
fail("to run integration tests, you need to set -Dtest.aws=true and -Dtests.config=/path/to/elasticsearch.yml");
98+
throw new IllegalStateException("to run integration tests, you need to set -Dtest.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml");
10999
}
110100
} catch (FailedToResolveConfigException exception) {
111-
fail("your test configuration file is incorrect: " + System.getProperty("tests.config"));
101+
throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception);
112102
}
113103
return settings.build();
114104
}

src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryITest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222

2323
import org.elasticsearch.cloud.aws.AbstractAwsTest;
24-
import org.elasticsearch.cloud.aws.AbstractAwsTest.AwsTest;
2524
import org.elasticsearch.common.settings.Settings;
2625
import org.elasticsearch.plugins.PluginsService;
2726
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
@@ -35,7 +34,6 @@
3534
* starting.
3635
* This test requires AWS to run.
3736
*/
38-
@AwsTest
3937
@ClusterScope(scope = Scope.TEST, numDataNodes = 0, numClientNodes = 0, transportClientRatio = 0.0)
4038
public class Ec2DiscoveryITest extends AbstractAwsTest {
4139

src/test/java/org/elasticsearch/discovery/ec2/Ec2DiscoveryUpdateSettingsITest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
2424
import org.elasticsearch.cloud.aws.AbstractAwsTest;
25-
import org.elasticsearch.cloud.aws.AbstractAwsTest.AwsTest;
2625
import org.elasticsearch.common.settings.Settings;
2726
import org.elasticsearch.plugins.PluginsService;
2827
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
@@ -37,7 +36,6 @@
3736
* starting.
3837
* This test requires AWS to run.
3938
*/
40-
@AwsTest
4139
@ClusterScope(scope = Scope.TEST, numDataNodes = 0, numClientNodes = 0, transportClientRatio = 0.0)
4240
public class Ec2DiscoveryUpdateSettingsITest extends AbstractAwsTest {
4341

src/test/java/org/elasticsearch/repositories/s3/AbstractS3SnapshotRestoreTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import com.amazonaws.services.s3.model.DeleteObjectsRequest;
2424
import com.amazonaws.services.s3.model.ObjectListing;
2525
import com.amazonaws.services.s3.model.S3ObjectSummary;
26+
2627
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
2728
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
2829
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
2930
import org.elasticsearch.client.Client;
3031
import org.elasticsearch.client.ClusterAdminClient;
3132
import org.elasticsearch.cloud.aws.AbstractAwsTest;
32-
import org.elasticsearch.cloud.aws.AbstractAwsTest.AwsTest;
3333
import org.elasticsearch.cloud.aws.AwsS3Service;
3434
import org.elasticsearch.cluster.ClusterState;
3535
import org.elasticsearch.common.settings.ImmutableSettings;
@@ -53,7 +53,6 @@
5353

5454
/**
5555
*/
56-
@AwsTest
5756
@ClusterScope(scope = Scope.SUITE, numDataNodes = 2, numClientNodes = 0, transportClientRatio = 0.0)
5857
abstract public class AbstractS3SnapshotRestoreTest extends AbstractAwsTest {
5958

0 commit comments

Comments
 (0)