Skip to content

Commit dfe11a8

Browse files
dkropachevtolbertam
authored andcommitted
Fix CustomCcmRule to drop CURRENT flag no matter what
If super.after() throws an Exception `CURRENT` flag is never dropped which leads next tests to fail with IllegalStateException("Attempting to use a Ccm rule while another is in use. This is disallowed") Patch by Dmitry Kropachev; reviewed by Andy Tolbert and Bret McGuire for JAVA-3117
1 parent f98e343 commit dfe11a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected void before() {
5353
after();
5454
} catch (Exception e1) {
5555
LOG.warn("Error cleaning up CustomCcmRule before() failure", e1);
56+
e.addSuppressed(e1);
5657
}
5758
throw e;
5859
}
@@ -64,8 +65,11 @@ protected void before() {
6465

6566
@Override
6667
protected void after() {
67-
super.after();
68-
CURRENT.compareAndSet(this, null);
68+
try {
69+
super.after();
70+
} finally {
71+
CURRENT.compareAndSet(this, null);
72+
}
6973
}
7074

7175
public CcmBridge getCcmBridge() {

0 commit comments

Comments
 (0)