Elffuss BraidHub

kikocis/java-driver public

Merge pull request #515 from datastax/isolatedTestGroup

Add isolated test group and profile for tests requiring their own JVM.
Changeset66fedda017c4cfc7c9248b315633f997dd7a9ffb3323e0c59b7e752efa1b927b
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-11-13 10:39 -06:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-11-13 10:39 -06:00
Parents17d4f1c4f29f, 3054d0f5d803

Browse the files at this changeset

6 files changed

modified build.yaml +13 −1
@@ -10,12 +10,24 @@
1010 build:
1111 - type: maven
1212 version: 3.2.5
13- goals: clean compile test --fail-never -Plong
13+ goals: verify --fail-never -Plong
1414 properties: |
1515 com.datastax.driver.TEST_BASE_NODE_WAIT=120
1616 com.datastax.driver.NEW_NODE_DELAY_SECONDS=100
1717 cassandra.version=$CCM_CASSANDRA_VERSION
1818 ccm.java.home=$CCM_JAVA_HOME
19+ failIfNoTests=false
20+ maven.test.failure.ignore=true
21+ - type: maven
22+ version: 3.2.5
23+ goals: verify --fail-never -Pisolated
24+ properties: |
25+ com.datastax.driver.TEST_BASE_NODE_WAIT=120
26+ com.datastax.driver.NEW_NODE_DELAY_SECONDS=100
27+ cassandra.version=$CCM_CASSANDRA_VERSION
28+ ccm.java.home=$CCM_JAVA_HOME
29+ failIfNoTests=false
30+ maven.test.failure.ignore=true
1931 - xunit:
2032 - "**/target/surefire-reports/TEST-*.xml"
2133 - "**/target/failsafe-reports/TEST-*.xml"
modified driver-core/pom.xml +35 −0
@@ -339,6 +339,41 @@
339339 </build>
340340 </profile>
341341
342+ <profile>
343+ <id>isolated</id>
344+ <properties>
345+ <env>default</env>
346+ </properties>
347+ <build>
348+ <plugins>
349+ <plugin>
350+ <groupId>org.apache.maven.plugins</groupId>
351+ <artifactId>maven-surefire-plugin</artifactId>
352+ <version>2.16</version>
353+ <configuration>
354+ <forkCount>1</forkCount>
355+ <reuseForks>false</reuseForks>
356+ <groups>isolated</groups>
357+ <!-- Files containing tests to be included must be added here.
358+ this prevents a fork being created for each test class. -->
359+ <includes>
360+ <include>**/SSL*Test.java</include>
361+ </includes>
362+ <reportNameSuffix>isolated</reportNameSuffix>
363+ <useFile>false</useFile>
364+ <systemPropertyVariables>
365+ <cassandra.version>${cassandra.version}</cassandra.version>
366+ <ipprefix>${ipprefix}</ipprefix>
367+ </systemPropertyVariables>
368+ <classpathDependencyExcludes>
369+ <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
370+ </classpathDependencyExcludes>
371+ </configuration>
372+ </plugin>
373+ </plugins>
374+ </build>
375+ </profile>
376+
342377 <profile>
343378 <id>long</id>
344379 <properties>
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +2 −2
@@ -429,13 +429,13 @@
429429 erroredOut = true;
430430 }
431431
432- @BeforeClass(groups = { "short", "long" })
432+ @BeforeClass(groups = { "isolated", "short", "long" })
433433 public void beforeClass() {
434434 maybeInitCluster();
435435 initKeyspace();
436436 }
437437
438- @AfterClass(groups = { "short", "long" })
438+ @AfterClass(groups = { "isolated", "short", "long" })
439439 public void afterClass() {
440440 try {
441441 clearSimpleKeyspace();
modified driver-core/src/test/java/com/datastax/driver/core/SSLAuthenticatedEncryptionTest.java +6 −10
@@ -67,17 +67,13 @@
6767 * @test_category connection:ssl, authentication
6868 * @expected_result Connection can be established.
6969 */
70- @Test(groups="short")
70+ @Test(groups="isolated")
7171 public void should_use_system_properties_with_default_ssl_options() throws Exception {
72- try {
73- System.setProperty("javax.net.ssl.keyStore", DEFAULT_CLIENT_KEYSTORE_FILE.getAbsolutePath());
74- System.setProperty("javax.net.ssl.keyStorePassword", DEFAULT_CLIENT_KEYSTORE_PASSWORD);
75- System.setProperty("javax.net.ssl.trustStore", DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath());
76- System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_CLIENT_TRUSTSTORE_PASSWORD);
72+ System.setProperty("javax.net.ssl.keyStore", DEFAULT_CLIENT_KEYSTORE_FILE.getAbsolutePath());
73+ System.setProperty("javax.net.ssl.keyStorePassword", DEFAULT_CLIENT_KEYSTORE_PASSWORD);
74+ System.setProperty("javax.net.ssl.trustStore", DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath());
75+ System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_CLIENT_TRUSTSTORE_PASSWORD);
7776
78- connectWithSSL();
79- } finally {
80- clearSystemProperties();
81- }
77+ connectWithSSL();
8278 }
8379 }
modified driver-core/src/test/java/com/datastax/driver/core/SSLEncryptionTest.java +4 −8
@@ -126,15 +126,11 @@
126126 * @test_category connection:ssl
127127 * @expected_result Connection can be established.
128128 */
129- @Test(groups="short")
129+ @Test(groups="isolated")
130130 public void should_use_system_properties_with_default_ssl_options() throws Exception {
131- try {
132- System.setProperty("javax.net.ssl.trustStore", DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath());
133- System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_CLIENT_TRUSTSTORE_PASSWORD);
131+ System.setProperty("javax.net.ssl.trustStore", DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath());
132+ System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_CLIENT_TRUSTSTORE_PASSWORD);
134133
135- connectWithSSL();
136- } finally {
137- clearSystemProperties();
138- }
134+ connectWithSSL();
139135 }
140136 }
modified driver-core/src/test/java/com/datastax/driver/core/SSLTestBase.java +2 −12
@@ -39,14 +39,14 @@
3939 this.requireClientAuth = requireClientAuth;
4040 }
4141
42- @BeforeClass(groups={"short", "long"})
42+ @BeforeClass(groups={"isolated", "short", "long"})
4343 public void beforeClass() {
4444 ccm = CCMBridge.builder("test")
4545 .withSSL(requireClientAuth)
4646 .build();
4747 }
4848
49- @AfterClass(groups={"short", "long"})
49+ @AfterClass(groups={"isolated", "short", "long"})
5050 public void afterClass() {
5151 ccm.remove();
5252 }
@@ -100,16 +100,6 @@
100100 }
101101 }
102102
103- /**
104- * Clears all System properties associated with SSL key and trust stores.
105- */
106- protected void clearSystemProperties() {
107- System.clearProperty("javax.net.ssl.keyStore");
108- System.clearProperty("javax.net.ssl.keyStorePassword");
109- System.clearProperty("javax.net.ssl.trustStore");
110- System.clearProperty("javax.net.ssl.trustStorePassword");
111- }
112-
113103 /**
114104 * @param keyStorePath Path to keystore, if absent is not used.
115105 * @param trustStorePath Path to truststore, if absent is not used.