SSHLibrary icon indicating copy to clipboard operation
SSHLibrary copied to clipboard

Improve output_if_timeout handling

Open MofX opened this issue 3 years ago • 0 comments

We are running some long running tests with a default test timeout. It is very annoying, to not have the output of the test for analysis of random timeouts. Therefore I hacked a monkey patches solution before, that enabled me, to fetch the output of the last command, that was not completely executed in Test Teardown.

After updating sshlibrary, I thought it was a good point, to refine this and output_if_timeout is now available, but sadly not really a good option, because it requires a timeout parameter for the Execute Command / Read Output instead of using the Test Timeout. On top of that the output is not decoded and printed as an array of byte data, that would require post processing, to make it readable.


This fixes two issues with the implementation of output_if_timeout:

  1. The raw byte data was sent to the logger. In order to improve improve readability, the output is now decoded and stdout and stderr is separated by a header/footer.
  2. The parameter handled only the timeout generated by the library, not the timeout generated by robot. Now both timeouts write the output to the logger, if output_if_timeout=True

Additionally for paramiko, a last read of the channel is done, to fetch as much of the output available as possible.

MofX avatar Jan 26 '22 11:01 MofX