-
-
Notifications
You must be signed in to change notification settings - Fork 752
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
Feature request #4715: configurable ssh connect timeout #4914
Feature request #4715: configurable ssh connect timeout #4914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is helpful, thanks for working on that!
To follow-up, check the CI build failure, - it shows some real suggestions around adding this new st2.conf setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any unit tests we can add for this new PR enhancement?
…pgithub.com:winem/st2 into feature-4715-make-ssh-connect-timeout-configurable
I thought about the unit tests as well and back then I just knew how to test it manually. It's probably a bit tricky but I think I just got an idea for a proper unit test that can differentiate between failures due to breaching the |
…out default of 60s
This reverts commit 4cb122d which passed the timeout parameter to the wrong method
…den ssh_connect_timeout
Marked as draft because a merge of the master branch into my feature branch went wrong. Will provide the proper solution before end of this week. In the meantime any input regarding my previous comment and the unit tests is highly appreciated! |
…pgithub.com:/winem/st2 into feature-4715-make-ssh-connect-timeout-configurable
…t via ssh" This reverts commit ecaf779.
Hi @armab, first of all, I fixed all the lint issues so that the current tests pass. I thought about the tests a bit more and am not sure what a proper implementation would look like. I know that some people use google.com:81 in tests to run a timeout but I think that every request to foreign infrastructure should be avoided (and is just the wrong way). Only thing that seems to be an option is to use Mocks side_effects and raise an exception. In this case we would see the exception but it's just a mocked one and does not actually prove that the action failed after the ssh_connect_timeout which would have to be lower than the action timeout in this case. So I ran out of ideas but am all in for ideas and every input is appreciated. Please let me know if you have any ideas or any hints for something I could look into. Cheers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thanks for the contribution!
Anytime! What do you think about the (missing) tests? Do you see any chance to cover this feature by a test? |
Currently I can't help much here, but I really appreciate the effort trying to add the test scenarios. If nothing worked, - I'm good to merge it as is. |
This PR adds support for ssh_connect_timeout as new configuration parameter in the ssh_runner group. It was suggested in #4715 and follows the fail-fast principle when the SSH connection can not even be established.
The runner will fail if the TCP connect to the target host does not succeed within the specified timeout. (see: http://docs.paramiko.org/en/stable/api/client.html -> SSHClient -> connect -> timeout).
This was tested with a high number of test cases with different defaults, ssh_connect_timeouts in the st2.conf and a variation of action timeouts.
This one makes #4913 which I just closed obsolete.