summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2018-11-06 16:56:22 +0800
committerChase Qi <chase.qi@linaro.org>2018-11-07 11:47:35 +0800
commitec92db0802c3ad501356fc30892754751215b881 (patch)
tree4a7fcb7292cbc9d48319e8a3e7d73d2232e66075
parentff49d31f433af4150f4ac374a2452cab273de65c (diff)
linux: add docker integration test for local daemon
Change-Id: Id44518c5cc8a74b4a272fd4e5587d7074dac9227 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/linux/docker-integration-test/local-daemon.sh80
-rw-r--r--automated/linux/docker-integration-test/local-daemon.yaml42
2 files changed, 122 insertions, 0 deletions
diff --git a/automated/linux/docker-integration-test/local-daemon.sh b/automated/linux/docker-integration-test/local-daemon.sh
new file mode 100755
index 0000000..465db59
--- /dev/null
+++ b/automated/linux/docker-integration-test/local-daemon.sh
@@ -0,0 +1,80 @@
+#!/bin/sh -ex
+
+TEST_DIR=$(dirname "$(realpath "$0")")
+OUTPUT="${TEST_DIR}/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+
+RELEASE="v18.03.0-ce"
+SKIP_INSTALL="false"
+
+# SC1090: Can't follow non-constant source. Use a directive to specify location.
+# shellcheck disable=SC1090
+. "${TEST_DIR}/../../lib/sh-test-lib"
+create_out_dir "${OUTPUT}"
+cd "${OUTPUT}"
+
+usage() {
+ echo "Usage: $0 [-r <release>] [-s <true|false>]" 1>&2
+ exit 1
+}
+
+while getopts "r:s:h" opt; do
+ case "$opt" in
+ r) RELEASE="${OPTARG}" ;;
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+if "${SKIP_INSTALL}"; then
+ info_msg "Software installation skipped"
+ # Check if required software pre-installed.
+ pkgs="git make docker"
+ for i in ${pkgs}; do
+ if ! command -v "$i"; then
+ error_msg "$i is required but not installed!"
+ fi
+ done
+else
+ install_deps "git make"
+ if ! command -v docker; then
+ install_deps "curl"
+ curl -fsSL get.docker.com -o get-docker.sh
+ sh get-docker.sh || error_msg "Failed to install docker-ce!"
+ fi
+fi
+
+git clone https://github.com/docker/docker-ce
+cd docker-ce/components/engine/
+git checkout "${RELEASE}" -b "${RELEASE}-test"
+# Enable shell xtrace and continue on test failure.
+sed -i 's/set -e -o pipefail/set -x -o pipefail/' hack/make/test-integration
+sed -i 's/); then exit 1; fi/); then echo "ERROR: non-zero exit"; fi/' hack/make/.integration-test-helpers
+git config --global user.email "tester@example.com"
+git config --global user.name "tester"
+git add -u hack/make/
+git commit -m 'test-integration: continue on test failure'
+# Skip legacy test integration-cli for the following reasons.
+# - buggy, at least on ARM.
+# - takes too long on ARM.
+# - deprecated in the Moby project.
+sed -i "s/run_test_integration_legacy_suites$//" hack/make/.integration-test-helpers
+git add -u hack/make/
+git commit -m "test-integration: skip integration-cli tests"
+
+# Test run.
+if make test-integration; then
+ echo "test-integration-run pass" | tee -a "${RESULT_FILE}"
+else
+ echo "test-integration-run fail" | tee -a "${RESULT_FILE}"
+fi
+
+# Parse test log.
+LOGFILE="bundles/test-integration/test.log"
+grep -Ee '--- (PASS|SKIP/FAIL):' "${LOGFILE}" \
+ | sed 's/PASS:/pass/; s/SKIP:/skip/; s/FAIL:/fail/' \
+ | awk '{printf("%s %s\n",$3,$2)}' \
+ | tee -a "${RESULT_FILE}"
+
+# Cleanup
+echo 'y' | docker system prune -a
diff --git a/automated/linux/docker-integration-test/local-daemon.yaml b/automated/linux/docker-integration-test/local-daemon.yaml
new file mode 100644
index 0000000..08e5fb1
--- /dev/null
+++ b/automated/linux/docker-integration-test/local-daemon.yaml
@@ -0,0 +1,42 @@
+metadata:
+ name: local-daemon
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "docker-ce engine integration test for local daemon. Docker's tests are
+ designed to run inside docker container. This test case clones
+ docker-ce repo and checks out the released tag to test and then lunchs
+ a container for testing. Inside the container, it creats a new binary
+ and runs a local docker daemon, and then runs all tests against the
+ daemon."
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - ubuntu
+ - debian
+ - centos
+ - fedora
+ - openembedded
+ devices:
+ - d03
+ - d05
+ - juno
+ - beaglebone-black
+ - hi6220-hikey
+ - apq8016-sbc
+ - mustang
+ - moonshot
+ - thunderX
+ - x15
+
+ scope:
+ - functional
+
+params:
+ SKIP_INSTALL: "false"
+ # docker-ce release version.
+ RELEASE: "v18.03.0-ce"
+
+run:
+ steps:
+ - cd automated/linux/docker-integration-test
+ - ./local-daemon.sh -r "${RELEASE}" -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt