File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,15 @@ public class CustomCcmRule extends BaseCcmRule {
39
39
@ Override
40
40
protected void before () {
41
41
if (CURRENT .get () == null && CURRENT .compareAndSet (null , this )) {
42
- super .before ();
42
+ try {
43
+ super .before ();
44
+ } catch (Exception e ) {
45
+ // If exception is thrown in this rule, `after` is not going to be executed and test suit is
46
+ // going to become broken
47
+ // So we need to drop CURRENT to let other tests run
48
+ CURRENT .set (null );
49
+ throw e ;
50
+ }
43
51
} else if (CURRENT .get () != this ) {
44
52
throw new IllegalStateException (
45
53
"Attempting to use a Ccm rule while another is in use. This is disallowed" );
@@ -48,8 +56,11 @@ protected void before() {
48
56
49
57
@ Override
50
58
protected void after () {
51
- super .after ();
52
- CURRENT .compareAndSet (this , null );
59
+ try {
60
+ super .after ();
61
+ } finally {
62
+ CURRENT .compareAndSet (this , null );
63
+ }
53
64
}
54
65
55
66
public CcmBridge getCcmBridge () {
You can’t perform that action at this time.
0 commit comments