dkropachev commented on code in PR #1720:
URL: 
https://github.com/apache/cassandra-java-driver/pull/1720#discussion_r1754999058


##########
test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CustomCcmRule.java:
##########
@@ -37,7 +40,20 @@ public class CustomCcmRule extends BaseCcmRule {
   @Override
   protected void before() {
     if (CURRENT.get() == null && CURRENT.compareAndSet(null, this)) {
-      super.before();
+      try {
+        super.before();
+      } catch (Exception e) {
+        // ExternalResource will not call after() when before() throws an 
exception
+        // Let's try and clean up and release the lock we have in CURRENT
+        LOG.warn(
+            "Error in CustomCcmRule before() method, attempting to clean up 
leftover state", e);
+        try {
+          after();

Review Comment:
   Another question, will it break `RuleChain` sequence ?  
   Meaning if `CustomCcmRule` is part of the `RuleChain`:
   `CustomCcmRule`, `Rule#1`
   then `RuleChain.before` calls `CustomCcmRule.before` and then `Rule#1.before`
   when test or any rule fails it is going to call:
   `RuleChain.after` which is going to call `Rule#1.after` and only then 
`CustomCcmRule.after`.
   If you do call `after()` here it changes the sequence and can cause 
unexpected consuquences.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to