File tree Expand file tree Collapse file tree 7 files changed +17
-6
lines changed
trino-product-tests-launcher/src/main/java/io/trino/tests/product/launcher/cli
trino-testing-containers/src/main/java/io/trino/testing/containers
trino-testing-services/src/main/java/io/trino Expand file tree Collapse file tree 7 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 53
53
54
54
import static com .google .common .base .Strings .isNullOrEmpty ;
55
55
import static com .google .common .collect .ImmutableList .toImmutableList ;
56
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
56
57
import static io .trino .tests .product .launcher .env .DockerContainer .cleanOrCreateHostPath ;
57
58
import static io .trino .tests .product .launcher .env .EnvironmentContainers .TESTS ;
58
59
import static io .trino .tests .product .launcher .env .EnvironmentListener .getStandardListeners ;
@@ -335,7 +336,7 @@ private Environment getEnvironment()
335
336
unsafelyExposePort (container , 5007 ); // debug port
336
337
}
337
338
338
- if (System . getenv ("CONTINUOUS_INTEGRATION" ) != null ) {
339
+ if (isEnvSet ("CONTINUOUS_INTEGRATION" )) {
339
340
container .withEnv ("CONTINUOUS_INTEGRATION" , "true" );
340
341
}
341
342
Original file line number Diff line number Diff line change 31
31
import static com .google .common .base .Preconditions .checkState ;
32
32
import static com .google .common .base .Strings .padEnd ;
33
33
import static com .google .common .collect .ImmutableList .toImmutableList ;
34
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
34
35
import static io .trino .testing .containers .ConditionalPullPolicy .TESTCONTAINERS_NEVER_PULL ;
35
36
import static java .lang .Boolean .parseBoolean ;
36
37
import static java .lang .System .getenv ;
@@ -72,7 +73,7 @@ public static String getPathFromClassPathResource(String resourcePath)
72
73
73
74
public static void exposeFixedPorts (GenericContainer <?> container )
74
75
{
75
- checkState (System . getenv ("CONTINUOUS_INTEGRATION" ) == null , "" +
76
+ checkState (isEnvSet ("CONTINUOUS_INTEGRATION" ), "" +
76
77
"Exposing fixed ports should not be used in regular test code. This could break parallel test execution. " +
77
78
"This method is supposed to be invoked from local development helpers only e.g. QueryRunner.main(), " +
78
79
"hence it should never run on CI" );
Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ public static String requireEnv(String variable)
26
26
{
27
27
return requireNonNull (System .getenv (variable ), () -> "environment variable not set: " + variable );
28
28
}
29
+
30
+ public static boolean isEnvSet (String variable )
31
+ {
32
+ return System .getenv (variable ) != null ;
33
+ }
29
34
}
Original file line number Diff line number Diff line change 37
37
import static com .google .common .base .Throwables .getStackTraceAsString ;
38
38
import static io .airlift .concurrent .Threads .daemonThreadsNamed ;
39
39
import static io .airlift .units .Duration .nanosSince ;
40
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
40
41
import static io .trino .testing .services .junit .Listeners .reportListenerFailure ;
41
42
import static java .lang .String .format ;
42
43
import static java .lang .management .ManagementFactory .getThreadMXBean ;
@@ -73,7 +74,7 @@ private static boolean isEnabled()
73
74
if (System .getProperty ("LogTestDurationListener.enabled" ) != null ) {
74
75
return Boolean .getBoolean ("LogTestDurationListener.enabled" );
75
76
}
76
- if (System . getenv ("CONTINUOUS_INTEGRATION" ) != null ) {
77
+ if (isEnvSet ("CONTINUOUS_INTEGRATION" )) {
77
78
return true ;
78
79
}
79
80
// For local development, logging durations is not typically useful.
Original file line number Diff line number Diff line change 28
28
import java .util .regex .Pattern ;
29
29
30
30
import static com .google .common .base .Throwables .getStackTraceAsString ;
31
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
31
32
import static java .lang .String .format ;
32
33
33
34
public class FlakyTestRetryAnalyzer
@@ -54,7 +55,7 @@ public boolean retry(ITestResult result)
54
55
55
56
Optional <String > enabledSystemPropertyValue = Optional .ofNullable (System .getProperty (ENABLED_SYSTEM_PROPERTY ));
56
57
if (!enabledSystemPropertyValue .map (Boolean ::parseBoolean )
57
- .orElseGet (() -> System . getenv ("CONTINUOUS_INTEGRATION" ) != null )) {
58
+ .orElseGet (() -> isEnvSet ("CONTINUOUS_INTEGRATION" ))) {
58
59
log .info (
59
60
"FlakyTestRetryAnalyzer not enabled: " +
60
61
"CONTINUOUS_INTEGRATION environment is not detected or " +
Original file line number Diff line number Diff line change 39
39
import static com .google .common .base .Throwables .getStackTraceAsString ;
40
40
import static io .airlift .concurrent .Threads .daemonThreadsNamed ;
41
41
import static io .airlift .units .Duration .nanosSince ;
42
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
42
43
import static io .trino .testng .services .Listeners .formatTestName ;
43
44
import static io .trino .testng .services .Listeners .reportListenerFailure ;
44
45
import static java .lang .String .format ;
@@ -79,7 +80,7 @@ private static boolean isEnabled()
79
80
if (System .getProperty ("LogTestDurationListener.enabled" ) != null ) {
80
81
return Boolean .getBoolean ("LogTestDurationListener.enabled" );
81
82
}
82
- if (System . getenv ("CONTINUOUS_INTEGRATION" ) != null ) {
83
+ if (isEnvSet ("CONTINUOUS_INTEGRATION" )) {
83
84
return true ;
84
85
}
85
86
// LogTestDurationListener does not support concurrent invocations of same test method
Original file line number Diff line number Diff line change 25
25
import java .math .BigDecimal ;
26
26
import java .math .RoundingMode ;
27
27
28
+ import static io .trino .testing .SystemEnvironmentUtils .isEnvSet ;
28
29
import static io .trino .testng .services .Listeners .formatTestName ;
29
30
import static java .lang .String .format ;
30
31
@@ -47,7 +48,7 @@ private static boolean isEnabled()
47
48
if (System .getProperty ("ProgressLoggingListener.enabled" ) != null ) {
48
49
return Boolean .getBoolean ("ProgressLoggingListener.enabled" );
49
50
}
50
- if (System . getenv ("CONTINUOUS_INTEGRATION" ) != null ) {
51
+ if (isEnvSet ("CONTINUOUS_INTEGRATION" )) {
51
52
return true ;
52
53
}
53
54
// most often not useful for local development
You can’t perform that action at this time.
0 commit comments