Skip to content

Commit

Permalink
Fix local maven build of presto-testng-services
Browse files Browse the repository at this point in the history
Previously retrying could be only enabled via CONTINUOUS_INTEGRATION.
This commit restores ability to enable retrying via system properties.
  • Loading branch information
kokosing committed Nov 21, 2020
1 parent de57a1a commit 66ffde0
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@ public boolean retry(ITestResult result)
return false;
}

String enabledSystemPropertyValue = System.getProperty(ENABLED_SYSTEM_PROPERTY);
if (enabledSystemPropertyValue != null) {
if (!parseBoolean(enabledSystemPropertyValue)) {
log.info("not retrying; FlakyTestRetryAnalyzer explicitly disabled ('%s' property set to '%s')", ENABLED_SYSTEM_PROPERTY, enabledSystemPropertyValue);
return false;
}
}
// Enable retry on CI by default
if (System.getenv("CONTINUOUS_INTEGRATION") == null) {
log.info("not retrying; FlakyTestRetryAnalyzer not enabled as CONTINUOUS_INTEGRATION environment was not detected");
if (!isEnabled()) {
return false;
}

Expand Down Expand Up @@ -107,6 +98,25 @@ public boolean retry(ITestResult result)
return true;
}

private static boolean isEnabled()
{
String enabledSystemPropertyValue = System.getProperty(ENABLED_SYSTEM_PROPERTY);
if (parseBoolean(enabledSystemPropertyValue)) {
return true;
}
// Enable retry on CI by default
if (System.getenv("CONTINUOUS_INTEGRATION") != null) {
return true;
}
log.info(
"not retrying; FlakyTestRetryAnalyzer not enabled because: " +
"CONTINUOUS_INTEGRATION environment is not detected, " +
"system property '%s' is not set to 'true' (but to '%s')",
ENABLED_SYSTEM_PROPERTY,
enabledSystemPropertyValue);
return false;
}

private static String getName(ITestNGMethod method, Object[] parameters)
{
String actualTestClass = method.getTestClass().getName();
Expand Down

0 comments on commit 66ffde0

Please sign in to comment.