Skip to content

Commit 6a8ed45

Browse files
Added logic to mute noisy env vars.
1 parent 4666c89 commit 6a8ed45

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

dd-smoke-tests/src/main/groovy/datadog/smoketest/ProcessManager.groovy

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ abstract class ProcessManager extends Specification {
7777
(0..<numberOfProcesses).each { idx ->
7878
ProcessBuilder processBuilder = createProcessBuilder(idx)
7979

80-
processBuilder.environment().put("JAVA_HOME", System.getProperty("java.home"))
81-
processBuilder.environment().put("DD_API_KEY", apiKey())
80+
Map<String, String> env = processBuilder.environment()
81+
env.put("JAVA_HOME", System.getProperty("java.home"))
82+
env.put("DD_API_KEY", apiKey())
83+
muteNoisyEnvironmentVariables(env)
8284

8385
processBuilder.redirectErrorStream(true)
8486

@@ -191,6 +193,21 @@ abstract class ProcessManager extends Specification {
191193
|| line.contains("Failed to handle exception in instrumentation")
192194
}
193195

196+
/**
197+
* @return Set of noisy variables to remove.
198+
*/
199+
protected Set<String> noisyEnvironmentVariables() {
200+
return ['CI_COMMIT_MESSAGE'] as Set
201+
}
202+
203+
/**
204+
* Some variable can be printed in smoke application logs and result into false-positive test result.
205+
* @param env environment variables to process.
206+
*/
207+
void muteNoisyEnvironmentVariables(Map<String, String> env) {
208+
noisyEnvironmentVariables().each { String envVar -> env.remove(envVar) }
209+
}
210+
194211
/**
195212
* Asserts that there are no errors printed by the application to the log.
196213
* This should usually be called after the process exits, otherwise it's not guaranteed that reading the log file will

0 commit comments

Comments
 (0)