Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
better tests using new infra, and use DI rather than patching #5250
Conversation
|
$$fixes-1579059$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Generating tarball failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$nobutseriously$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
natefinch commentedApr 21, 2016
Small change to the Main function so that it returns its exit code, rather than calling os.Exit, since the latter makes calling it in tests impossible. Also change Main to call a sub-function main, which takes dependencies for mocking out exec.LookPath and exec.Command.
Fix the tests so that they use the functionality added to github.com/juju/testing in juju/testing#95 - use the new PatchExecHelper type and CaptureOutput function so that we can isolate this code without having to have all that complicated code right here in the tests (and thus it can be reused for other tests).
(Review request: http://reviews.vapour.ws/r/4677/)