From c62d7149f1da9514ef53969924270a054418ca56 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Sat, 16 Jun 2018 17:53:50 +0200 Subject: [PATCH 1/2] fix build on OpenBSD by defining Self() Signed-off-by: Fabian Raetz Upstream-commit: 21537b818de5e4167c5a3856c25b9b06cf16d87d Component: engine --- components/engine/pkg/reexec/command_unsupported.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/engine/pkg/reexec/command_unsupported.go b/components/engine/pkg/reexec/command_unsupported.go index 09fb4b2d29..e7eed24240 100644 --- a/components/engine/pkg/reexec/command_unsupported.go +++ b/components/engine/pkg/reexec/command_unsupported.go @@ -6,6 +6,10 @@ import ( "os/exec" ) +func Self() string { + return "" +} + // Command is unsupported on operating systems apart from Linux, Windows, and Darwin. func Command(args ...string) *exec.Cmd { return nil From 0278df1cff16c9fb40f93c1e0c3fd7ba61d020d5 Mon Sep 17 00:00:00 2001 From: Anda Xu Date: Fri, 8 Jun 2018 16:37:30 -0700 Subject: [PATCH 2/2] add integration test guidelines Signed-off-by: Anda Xu Upstream-commit: 2d5ea98b2c2223e97627aa0d03e68c3f84e3b662 Component: engine --- components/engine/TESTING.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/engine/TESTING.md b/components/engine/TESTING.md index 1231e1c5f4..871d6324d8 100644 --- a/components/engine/TESTING.md +++ b/components/engine/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: