Conversation
This allows for a clean test output.
c54ab0e to
e86a6ec
Compare
|
Updated the test setup to get it running on Travis CI. |
VojtechVitek
left a comment
There was a problem hiding this comment.
Can you explain in high level what the provided tests do exactly?
|
Sure, the basic idea is to move the most of the Each test spins up mock a set of SSH servers which only record command and provide them back for assertions, they don't do anything else. The server addresses are written into an SSH config file in a tmp directory alongside generated key and cert for the SSH servers, public and private key pair of the client. Every test contains YAML string with the Supfile being tested. The test runs this Supfile from parsing YAML, to setting up The tests cover basic things like missing networks, commands, targets etc., simple command, sequence of commands, a target, The code for the mock servers is horrible. I assume it can be improved but I just stitched it together from different examples and by trial and error. I'm happy to answer any more questions. |
This PR builds on top of #134. It adds tests for sup commad as a sanity check of the existing functionality. In order to accomplish it I had to adjust the code in few places:
maintorunSupfileso that it can be run from testsioutil.Discardin testsSSHClientgot new fields so that I could remove the global variableinitAuthMethodOncepreventing running the command multiple times (aka when running tests)The tests which need to spin up mock SSH servers, capture the requests and always respond with success. I barely understand this part and it's put together from different examples around the web.
I'm doing this as a preparation for tackling #130.