Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 035c10f

Browse files
committed
Merge pull request apache#515 from datastax/isolatedTestGroup
Add isolated test group and profile for tests requiring their own JVM.
2 parents d7a6a3f + cd3592c commit 035c10f

6 files changed

Lines changed: 62 additions & 33 deletions

File tree

build.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@ cassandra:
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"

driver-core/pom.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,13 @@ public void errorOut() {
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();

driver-core/src/test/java/com/datastax/driver/core/SSLAuthenticatedEncryptionTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,13 @@ public void should_not_connect_without_client_auth_but_node_requires_auth() thro
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
}

driver-core/src/test/java/com/datastax/driver/core/SSLEncryptionTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,11 @@ public void should_reconnect_with_ssl_on_node_up() throws Exception {
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
}

driver-core/src/test/java/com/datastax/driver/core/SSLTestBase.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public SSLTestBase(boolean requireClientAuth) {
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 @@ protected void connectWithSSL() throws Exception {
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.

0 commit comments

Comments
 (0)