Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve output_if_timeout handling #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MofX
Copy link

@MofX MofX commented Jan 26, 2022

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant