diff options
author | Aleksa Sarai <asarai@suse.de> | 2019-03-12 18:37:31 +1100 |
---|---|---|
committer | Aleksa Sarai <asarai@suse.de> | 2019-03-13 11:48:40 +1100 |
commit | 175b1d783013b7e73f117f512e1179ee3b66a697 (patch) | |
tree | d1a2f51b0b2ff797afaad41fcae91f6641765699 /integration-cli/fixtures_linux_daemon_test.go | |
parent | d283c7fa2b93e00d4e1b0feaee99028b00dd775d (diff) | |
download | docker-175b1d783013b7e73f117f512e1179ee3b66a697.tar.gz |
integration-cli: don't build -test images if they already exist
There's no need to try to re-build the test images if they already
exist. This change makes basically no difference to the upstream
integration test-suite running, but for users who want to run the
integration-cli suite on a host machine (such as distributions doing
tests) this change allows images to be pre-loaded such that compilers
aren't needed on the test machine.
However, this does remove the accidental re-compilation of nnp-test, as
well as handling errors far more cleanly (previously if an error
occurred during a test build, further tests won't attempt to rebuild
it).
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Diffstat (limited to 'integration-cli/fixtures_linux_daemon_test.go')
-rw-r--r-- | integration-cli/fixtures_linux_daemon_test.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/integration-cli/fixtures_linux_daemon_test.go b/integration-cli/fixtures_linux_daemon_test.go index 2387a9ebee..0a770a76a2 100644 --- a/integration-cli/fixtures_linux_daemon_test.go +++ b/integration-cli/fixtures_linux_daemon_test.go @@ -8,7 +8,6 @@ import ( "path/filepath" "runtime" "strings" - "sync" "github.com/docker/docker/integration-cli/checker" "github.com/docker/docker/internal/test/fixtures/load" @@ -24,17 +23,13 @@ type logT interface { Logf(string, ...interface{}) } -var ensureSyscallTestOnce sync.Once - func ensureSyscallTest(c *check.C) { - var doIt bool - ensureSyscallTestOnce.Do(func() { - doIt = true - }) - if !doIt { + defer testEnv.ProtectImage(c, "syscall-test:latest") + + // If the image already exists, there's nothing left to do. + if testEnv.HasExistingImage(c, "syscall-test:latest") { return } - defer testEnv.ProtectImage(c, "syscall-test:latest") // if no match, must build in docker, which is significantly slower // (slower mostly because of the vfs graphdriver) @@ -93,6 +88,14 @@ func ensureSyscallTestBuild(c *check.C) { func ensureNNPTest(c *check.C) { defer testEnv.ProtectImage(c, "nnp-test:latest") + + // If the image already exists, there's nothing left to do. + if testEnv.HasExistingImage(c, "nnp-test:latest") { + return + } + + // if no match, must build in docker, which is significantly slower + // (slower mostly because of the vfs graphdriver) if testEnv.OSType != runtime.GOOS { ensureNNPTestBuild(c) return |