File tree Expand file tree Collapse file tree
main/java/com/cloud/utils/script
test/java/com/cloud/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,11 @@ public String interpret(BufferedReader reader) throws IOException {
137137 public String getLines () {
138138 return allLines ;
139139 }
140+
141+ @ Override
142+ public boolean drain () {
143+ return true ;
144+ }
140145 }
141146
142147 public static class LineByLineOutputLogger extends OutputInterpreter {
Original file line number Diff line number Diff line change @@ -111,6 +111,20 @@ public String interpret(BufferedReader reader) throws IOException {
111111 Assert .assertNotNull (value );
112112 }
113113
114+ @ Test
115+ public void executeWithOutputInterpreterAllLinesParserLargeOutput () {
116+ Assume .assumeTrue (SystemUtils .IS_OS_LINUX );
117+ OutputInterpreter .AllLinesParser parser = new OutputInterpreter .AllLinesParser ();
118+ Script script = new Script ("seq" );
119+ script .add ("-f" );
120+ script .add ("my text to test cloudstack %g" );
121+ script .add ("4096" ); // AllLinesParser doesn't work with that amount of data
122+ String value = script .execute (parser );
123+ // it is a stack trace in this case as string
124+ Assert .assertNull (value );
125+ Assert .assertEquals (129965 , parser .getLines ().length ());
126+ }
127+
114128 @ Test
115129 public void runSimpleBashScriptNotExisting () {
116130 Assume .assumeTrue (SystemUtils .IS_OS_LINUX );
You can’t perform that action at this time.
0 commit comments