SHA256
1
0
forked from pool/docker
Aleksa Sarai 2019-03-12 08:21:05 +00:00 committed by Git OBS Bridge
parent aa89492db8
commit ea139541fa
2 changed files with 38 additions and 26 deletions

View File

@ -1,6 +1,6 @@
From 911af815ea12dacb81afef0a6704c73d48df01d3 Mon Sep 17 00:00:00 2001
From 87416bfab7420bb5d0b18269909eb71dcb8632c6 Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <asarai@suse.de>
Date: Tue, 12 Mar 2019 18:48:38 +1100
Date: Tue, 12 Mar 2019 18:37:31 +1100
Subject: [PATCH] integration-cli: don't build -test images if they already
exist
@ -11,18 +11,31 @@ 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).
SUSE-Bugs: bsc#1128746
Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
.../fixtures_linux_daemon_test.go | 20 +++++++++++--------
.../internal/test/environment/environment.go | 20 +++++++++++++++++++
2 files changed, 32 insertions(+), 8 deletions(-)
.../fixtures_linux_daemon_test.go | 21 +++++++++--------
.../internal/test/environment/environment.go | 23 +++++++++++++++++++
2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/components/engine/integration-cli/fixtures_linux_daemon_test.go b/components/engine/integration-cli/fixtures_linux_daemon_test.go
index 2387a9ebee2b..ae01180d8523 100644
index 2387a9ebee2b..0a770a76a2a9 100644
--- a/components/engine/integration-cli/fixtures_linux_daemon_test.go
+++ b/components/engine/integration-cli/fixtures_linux_daemon_test.go
@@ -24,17 +24,13 @@ type logT interface {
@@ -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{})
}
@ -44,7 +57,7 @@ index 2387a9ebee2b..ae01180d8523 100644
// if no match, must build in docker, which is significantly slower
// (slower mostly because of the vfs graphdriver)
@@ -93,6 +89,14 @@ func ensureSyscallTestBuild(c *check.C) {
@@ -93,6 +88,14 @@ func ensureSyscallTestBuild(c *check.C) {
func ensureNNPTest(c *check.C) {
defer testEnv.ProtectImage(c, "nnp-test:latest")
@ -60,17 +73,30 @@ index 2387a9ebee2b..ae01180d8523 100644
ensureNNPTestBuild(c)
return
diff --git a/components/engine/internal/test/environment/environment.go b/components/engine/internal/test/environment/environment.go
index 74c8e2ce0ad7..56692a4f6594 100644
index 74c8e2ce0ad7..e1c8a49ea8cb 100644
--- a/components/engine/internal/test/environment/environment.go
+++ b/components/engine/internal/test/environment/environment.go
@@ -145,6 +145,26 @@ func (e *Execution) APIClient() client.APIClient {
@@ -8,9 +8,12 @@ import (
"strings"
"github.com/docker/docker/api/types"
+ "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"
+ "github.com/docker/docker/internal/test"
"github.com/docker/docker/internal/test/fixtures/load"
"github.com/pkg/errors"
+ "gotest.tools/assert"
)
// Execution contains information about the current test execution and daemon
@@ -145,6 +148,26 @@ func (e *Execution) APIClient() client.APIClient {
return e.client
}
+// HasExistingImage checks whether there is an image with the given reference.
+// Note that this is done by filtering and then checking whether there were any
+// results -- so ambiguous references might result in false-positives.
+func (e *Execution) HasExistingImage(t TestingT, reference string) bool {
+func (e *Execution) HasExistingImage(t testingT, reference string) bool {
+ if ht, ok := t.(test.HelperT); ok {
+ ht.Helper()
+ }

View File

@ -37,7 +37,7 @@ abort_usage() { usage ; abort "$@" ; }
bundle() {
local bundle="$1"; shift
log "Making bundle: $(basename "$bundle") (in $DEST)"
log "Making bundle: $(basename "$bundle") (in $PWD)"
local oldFlags="$-"
set +Eeu
source "$SCRIPTS_DIR/make/$bundle" "$@"
@ -82,19 +82,6 @@ if [ "$#" -gt 0 ] ; then
TEST_ARGS+=( "-check.f=$(echo $@ | tr ' ' '|')" )
fi
# We want this to fail if the bundles already exist and cannot be removed.
# This is to avoid mixing bundles from different versions of the code.
mkdir -p "$BUNDLES_DIR"
if [ -e "$BUNDLES_DIR/$VERSION" ] && [ -z "$KEEPBUNDLE" ]; then
log "$BUNDLES_DIR/$VERSION already exists. Removing."
rm -fr "$BUNDLES_DIR/$VERSION" && mkdir "$BUNDLES_DIR/$VERSION" || exit 1
echo
fi
DEST="$BUNDLES_DIR/$VERSION/"
mkdir -p "$DEST"
export DEST="$(realpath "$DEST")"
if [ -n "$ENABLE_XUNIT" ] ; then
if [ ! -x /usr/local/bin/go2xunit ] ; then
echo >&2 "Installing go2xunit."
@ -154,7 +141,6 @@ cat <<CFG_DOCKER_EOF >"$CFG_DOCKER"
"max-file": "5"
},
"userns-remap": "$DOCKER_REMAP_ROOT",
"pidfile": "$DEST/docker.pid",
"hosts": [
"tcp://127.0.0.1:2375"
],