diff options
| author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2018-06-25 20:44:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-25 20:44:42 +0200 |
| commit | 8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb (patch) | |
| tree | ba2184fec9879550d3b2f052a7c979b027875611 /TESTING.md | |
| parent | cb37987ee11655ed6bbef663d245e55922354c68 (diff) | |
| parent | 2d5ea98b2c2223e97627aa0d03e68c3f84e3b662 (diff) | |
| download | docker-8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb.tar.gz | |
Merge pull request #37249 from AntaresS/add-test-guidline
add integration test guidelines
Diffstat (limited to 'TESTING.md')
| -rw-r--r-- | TESTING.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/TESTING.md b/TESTING.md index 34ad843638..b2c53769ca 100644 --- a/TESTING.md +++ b/TESTING.md @@ -47,6 +47,24 @@ Bugs fixes should include a unit test case which exercises the bug. A bug fix may also include new assertions in an existing integration tests for the API endpoint. +### Integration tests environment considerations + +When adding new tests or modifying existing test under `integration/`, testing +environment should be properly considered. `skip.If` from +[gotest.tools/skip](https://godoc.org/gotest.tools/skip) can be used to make the +test run conditionally. Full testing environment conditions can be found at +[environment.go](https://github.com/moby/moby/blob/cb37987ee11655ed6bbef663d245e55922354c68/internal/test/environment/environment.go) + +Here is a quick example. If the test needs to interact with a docker daemon on +the same host, the following condition should be checked within the test code + +```go +skip.If(t, testEnv.IsRemoteDaemon()) +// your integration test code +``` + +If a remote daemon is detected, the test will be skipped. + ## Running tests To run the unit test suite: |
