mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
AllLinesParser: Enable draining of stdout (#8670)
This commit is contained in:
parent
6c6023b790
commit
f7603dcbcc
@ -137,6 +137,11 @@ public abstract class OutputInterpreter {
|
||||
public String getLines() {
|
||||
return allLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean drain() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LineByLineOutputLogger extends OutputInterpreter {
|
||||
|
||||
@ -111,6 +111,20 @@ public class ScriptTest {
|
||||
Assert.assertNotNull(value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executeWithOutputInterpreterAllLinesParserLargeOutput() {
|
||||
Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
|
||||
OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser();
|
||||
Script script = new Script("seq");
|
||||
script.add("-f");
|
||||
script.add("my text to test cloudstack %g");
|
||||
script.add("4096"); // AllLinesParser doesn't work with that amount of data
|
||||
String value = script.execute(parser);
|
||||
// it is a stack trace in this case as string
|
||||
Assert.assertNull(value);
|
||||
Assert.assertEquals(129965, parser.getLines().length());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void runSimpleBashScriptNotExisting() {
|
||||
Assume.assumeTrue(SystemUtils.IS_OS_LINUX);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user