xBis7 commented on PR #4134:
URL: https://github.com/apache/ozone/pull/4134#issuecomment-1418810458

   > For future, we should think how we can check the actual failure reason and 
validate that.
   
   @hemantk-12 In this case, the `GenericTestUtils.SystemOutCapturer` was 
capturing the output but it wasn't restoring the stream afterwards and 
`System.setOut()` wasn't getting restored.
   
   For instance, if we were to run 2-3 commands in one test and wanted to check 
the output for each and every one of them, the capturer would get the output of 
the first command and it would keep it for every new command. If we tried to 
close it and then create a new one, it would get stuck closing and the output 
would be empty for the other commands or tests.
   
   In `execShellCommandAndGetOutput`, we reset the stream 
[here](https://github.com/apache/ozone/blob/68fca589147b07dc34f36ca46b86f281a45390b0/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java#L307-L315),
 so that `System.setOut()` has an empty `ByteArrayOutputStream` and we can set 
a new value on the next method call.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to