util: fix hasFailed logic in tests when flaky tests fail
@@ -27,6 +27,7 @@ import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.killbill.billing.api.AbortAfterFirstFailureListener;
import org.killbill.billing.api.FlakyInvokedMethodListener;
+import org.killbill.billing.api.FlakyRetryAnalyzer;
import org.killbill.billing.callcontext.InternalTenantContext;
import org.killbill.billing.callcontext.MutableCallContext;
import org.killbill.billing.callcontext.MutableInternalCallContext;
@@ -232,9 +233,13 @@ public class GuicyKillbillTestSuite implements IHookable {
(result.getEndMillis() - result.getStartMillis()) / 1000});
log.info("***************************************************************************************************");
if (!hasFailed && !result.isSuccess()) {
+ // Ignore if the current test method is flaky
+ final boolean isFlakyTest = result.getMethod().getRetryAnalyzer() != null && result.getMethod().getRetryAnalyzer() instanceof FlakyRetryAnalyzer;
+ if (!isFlakyTest) {
hasFailed = true;
}
}
+ }
// Note: assertions should not be run in before / after hooks, as the associated test result won't be correctly updated.
// Use this wrapper instead.
