Update tests to make them work on any environment (esp docker)
diff --git a/qa/src/test/java/org/apache/brooklyn/qa/longevity/MonitorUtilsTest.java b/qa/src/test/java/org/apache/brooklyn/qa/longevity/MonitorUtilsTest.java
index f58963c..acacc6e 100644
--- a/qa/src/test/java/org/apache/brooklyn/qa/longevity/MonitorUtilsTest.java
+++ b/qa/src/test/java/org/apache/brooklyn/qa/longevity/MonitorUtilsTest.java
@@ -72,7 +72,7 @@
String errSuffix = writeToErr ? " >&2" : "";
//Windows limits the length of the arguments so echo multiple times instead
String bigstr = Strings.repeat("a", 8000);
- String bigcmd = Strings.repeat(getSilentPrefix() + "echo " + bigstr + errSuffix + Os.LINE_SEPARATOR, 15);
+ String bigcmd = getExecPrefix() + Strings.repeat(getSilentPrefix() + "echo " + bigstr + errSuffix + Os.LINE_SEPARATOR, 15);
File file = Os.newTempFile("test-consume", ".bat");
file.setExecutable(true);
Files.write(bigcmd, file, Charsets.UTF_8);
@@ -161,4 +161,12 @@
}
}
+ private String getExecPrefix() {
+ if (Os.isMicrosoftWindows()) {
+ return "";
+ } else {
+ return "#!/bin/sh\n";
+ }
+ }
+
}