Accepting request 684497 from home:cyphar:containers:docker-test
More tests.sh improvements to increase the success percentage and to run dockerd-related tests. OBS-URL: https://build.opensuse.org/request/show/684497 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=303
This commit is contained in:
parent
ea139541fa
commit
334335e0e5
@ -219,11 +219,13 @@ Zsh command line completion support for %{name}.
|
|||||||
%package test
|
%package test
|
||||||
%global __requires_exclude ^libgo.so.*$
|
%global __requires_exclude ^libgo.so.*$
|
||||||
Summary: Test package for docker
|
Summary: Test package for docker
|
||||||
|
# Needed for test-suite.
|
||||||
Group: System/Management
|
Group: System/Management
|
||||||
Requires: curl
|
Requires: curl
|
||||||
Requires: go
|
Requires: go
|
||||||
Requires: iputils
|
Requires: iputils
|
||||||
Requires: jq
|
Requires: jq
|
||||||
|
Requires: net-tools-deprecated
|
||||||
# KUBIC-SPECIFIC: This was required when upgrading from the original kubic
|
# KUBIC-SPECIFIC: This was required when upgrading from the original kubic
|
||||||
# packaging, when everything was renamed to -kubic. It also is
|
# packaging, when everything was renamed to -kubic. It also is
|
||||||
# used to ensure that nothing complains too much when using
|
# used to ensure that nothing complains too much when using
|
||||||
|
43
tests.sh
43
tests.sh
@ -16,11 +16,10 @@ FROZEN_IMAGES_LINK=/docker-frozen-images
|
|||||||
|
|
||||||
readarray -t TESTS < <(find "$DOCKER_DIR/integration-cli" -type f -executable -name 'tests.main')
|
readarray -t TESTS < <(find "$DOCKER_DIR/integration-cli" -type f -executable -name 'tests.main')
|
||||||
CHECK_TIMEOUT="${CHECK_TIMEOUT:-15m}"
|
CHECK_TIMEOUT="${CHECK_TIMEOUT:-15m}"
|
||||||
TEST_TIMEOUT="${TEST_TIMEOUT:-6h}"
|
TEST_TIMEOUT="${TEST_TIMEOUT:-0}"
|
||||||
TEST_ARGS=("-check.v" "-check.timeout=${CHECK_TIMEOUT}" "-test.timeout=${TEST_TIMEOUT}")
|
TEST_ARGS=("-check.v" "-check.timeout=${CHECK_TIMEOUT}" "-test.timeout=${TEST_TIMEOUT}")
|
||||||
TEST_SELECT=
|
TEST_SELECT=
|
||||||
TEST_LOG=/tmp/docker-tests.log
|
TEST_LOG=/tmp/docker-tests.log
|
||||||
ENABLE_XUNIT="${ENABLE_XUNIT-yes}"
|
|
||||||
KEEPBUNDLE="${KEEPBUNDLE:-}"
|
KEEPBUNDLE="${KEEPBUNDLE:-}"
|
||||||
|
|
||||||
# the config file for Docker
|
# the config file for Docker
|
||||||
@ -60,10 +59,8 @@ restore_backup() {
|
|||||||
for x in $@ ; do
|
for x in $@ ; do
|
||||||
if [ -f "$x.nbak" ] ; then
|
if [ -f "$x.nbak" ] ; then
|
||||||
rm -f "$x.nbak"
|
rm -f "$x.nbak"
|
||||||
else
|
elif [ -f "$x.bak" ] ; then
|
||||||
if [ -f "$x.bak" ] ; then
|
mv -f "$x.bak" "$x"
|
||||||
mv -f "$x.bak" "$x"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -82,24 +79,6 @@ if [ "$#" -gt 0 ] ; then
|
|||||||
TEST_ARGS+=( "-check.f=$(echo $@ | tr ' ' '|')" )
|
TEST_ARGS+=( "-check.f=$(echo $@ | tr ' ' '|')" )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$ENABLE_XUNIT" ] ; then
|
|
||||||
if [ ! -x /usr/local/bin/go2xunit ] ; then
|
|
||||||
echo >&2 "Installing go2xunit."
|
|
||||||
|
|
||||||
require_go || abort "the Go compiler is not installed"
|
|
||||||
|
|
||||||
export GOPATH="$(mktemp -d)"
|
|
||||||
|
|
||||||
go get -d github.com/tebeka/go2xunit
|
|
||||||
cd "$GOPATH/src/github.com/tebeka/go2xunit" && go build -o /usr/local/bin/go2xunit .
|
|
||||||
chmod 755 /usr/local/bin/go2xunit
|
|
||||||
[ -x /usr/local/bin/go2xunit ] || abort "go2xunit could not be built"
|
|
||||||
|
|
||||||
rm -rf "$GOPATH"
|
|
||||||
export -n GOPATH
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# tests require this user and group
|
# tests require this user and group
|
||||||
/usr/sbin/groupadd -r docker >/dev/null 2>&1 || /bin/true
|
/usr/sbin/groupadd -r docker >/dev/null 2>&1 || /bin/true
|
||||||
/usr/sbin/useradd --create-home --gid docker unprivilegeduser >/dev/null 2>&1 || /bin/true
|
/usr/sbin/useradd --create-home --gid docker unprivilegeduser >/dev/null 2>&1 || /bin/true
|
||||||
@ -159,6 +138,7 @@ cleanup() {
|
|||||||
rm -f "$FROZEN_IMAGES_LINK"
|
rm -f "$FROZEN_IMAGES_LINK"
|
||||||
|
|
||||||
log "Removing images and containers..."
|
log "Removing images and containers..."
|
||||||
|
export DOCKER_HOST="$DOCKER_TEST_HOST"
|
||||||
docker ps -aq | xargs docker rm -f &>/dev/null || :
|
docker ps -aq | xargs docker rm -f &>/dev/null || :
|
||||||
docker images -q | xargs docker rmi -f &>/dev/null || :
|
docker images -q | xargs docker rmi -f &>/dev/null || :
|
||||||
|
|
||||||
@ -203,6 +183,17 @@ do
|
|||||||
docker build -t "$(basename "$dir")" "$dir"
|
docker build -t "$(basename "$dir")" "$dir"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# For some reason, dockerd appears to put the containerd.sock in the wrong
|
||||||
|
# place under systemd. So we just manually add a symlink for it.
|
||||||
|
[ -e "/var/run/docker/containerd/containerd.sock" ] || \
|
||||||
|
ln -s docker-containerd.sock /var/run/docker/containerd/containerd.sock
|
||||||
|
|
||||||
|
# And there appears to be an issue with daemon.json as a configuration format,
|
||||||
|
# so we need to hide our generated configuration. The original will be restored
|
||||||
|
# in cleanup().
|
||||||
|
rm -f "$CFG_DOCKER"
|
||||||
|
|
||||||
|
# Run all of our tests.
|
||||||
rm -f "$TEST_LOG"
|
rm -f "$TEST_LOG"
|
||||||
for TEST in "${TESTS[@]}"
|
for TEST in "${TESTS[@]}"
|
||||||
do
|
do
|
||||||
@ -210,9 +201,5 @@ do
|
|||||||
log "Running integration test ($TEST)..." | tee -a "$TEST_LOG"
|
log "Running integration test ($TEST)..." | tee -a "$TEST_LOG"
|
||||||
"$TEST" "${TEST_ARGS[@]}" 2>&1 | tee -a "$TEST_LOG" || :
|
"$TEST" "${TEST_ARGS[@]}" 2>&1 | tee -a "$TEST_LOG" || :
|
||||||
done
|
done
|
||||||
if [ -n "$ENABLE_XUNIT" ] ; then
|
|
||||||
log "Generating xunit logs..."
|
|
||||||
go2xunit -fail -gocheck -input "$TEST_LOG" -output "$TEST_LOG.xml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
export -n DOCKER_HOST
|
export -n DOCKER_HOST
|
||||||
|
Loading…
Reference in New Issue
Block a user