From 44f29318dd2c427135a46b48279cbac028d5ce29 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 12:34:56 -0500 Subject: [PATCH 01/17] tests: Remove unused test_func_prefix This has been unused since 562be909 Signed-off-by: Cole Robinson --- tests/test_images.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 73c0ba57d3..d2bd1dce54 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -27,9 +27,6 @@ readonly KATA_HYPERVISOR="${KATA_HYPERVISOR:-}" readonly ci_results_dir="/var/osbuilder/tests" readonly dracut_dir=${script_dir}/../dracut -# all distro tests must have this prefix -readonly test_func_prefix="test_distro_" - # "docker build" does not work with a VM-based runtime readonly docker_build_runtime="runc" From c574ec0528f90ea7e389ceb84cfadc3f4f199ab2 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 14:29:33 -0500 Subject: [PATCH 02/17] tests: Remove dead unset images_dir check This value is set globally, so this condition will never trigger. `mkdir -p` would error anyways if it was unspecified Signed-off-by: Cole Robinson --- tests/test_images.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index d2bd1dce54..04f52d52b0 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -258,7 +258,6 @@ set_runtime() setup() { - [ -z "$images_dir" ] && die "need images directory" mkdir -p "${images_dir}" if [ -n "$CI" ]; then From cd46d09e0c3bdcaaeb17018525b91399fdee21e4 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 16:56:48 -0500 Subject: [PATCH 03/17] tests: Remove hardcoded 'runc' reference Replace it with docker_build_runtime which serves a similar purpose Signed-off-by: Cole Robinson --- tests/test_images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 04f52d52b0..444019cdeb 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -635,7 +635,7 @@ test_dracut() typeset -a dockerRunArgs=(\ --rm \ - --runtime=runc \ + --runtime="${docker_build_runtime}" \ -v "${images_dir}:${images_dir}" \ -v "${script_dir}/..":"${tmp_dir}" \ -v "${tmp_rootfs}:${tmp_rootfs}" \ From e8624d89d9c123580200833f4f75a0150c786430 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:06:07 -0500 Subject: [PATCH 04/17] tests: Rename docker_build_runtime -> DOCKER_RUNTIME DOCKER_RUNTIME is the naming used in the actual osbuilder scripts for this value. Change the test code to match Signed-off-by: Cole Robinson --- tests/test_images.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 444019cdeb..6eafd71066 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -20,6 +20,7 @@ readonly tests_repo_dir="${script_dir}/../../tests" readonly mgr="${tests_repo_dir}/cmd/kata-manager/kata-manager.sh" readonly test_config=${script_dir}/test_config.sh readonly rootfs_builder=${script_dir}/../rootfs-builder/rootfs.sh +readonly DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc} readonly RUNTIME=${RUNTIME:-kata-runtime} readonly MACHINE_TYPE=`uname -m` readonly CI=${CI:-} @@ -27,9 +28,6 @@ readonly KATA_HYPERVISOR="${KATA_HYPERVISOR:-}" readonly ci_results_dir="/var/osbuilder/tests" readonly dracut_dir=${script_dir}/../dracut -# "docker build" does not work with a VM-based runtime -readonly docker_build_runtime="runc" - build_images=1 build_initrds=1 typeset -a distrosSystemd distrosAgent @@ -286,8 +284,10 @@ setup() fi silent_run $mgr enable-debug - # Ensure "docker build" works - set_runtime "${docker_build_runtime}" + # "docker build" does not work with a VM-based runtime, and + # also does not accept a --runtime option, so our only + # option is to overwrite the system docker default runtime + set_runtime "${DOCKER_RUNTIME}" } # Fetches the distros test configuration from the distro-specific config.sh file. @@ -635,7 +635,7 @@ test_dracut() typeset -a dockerRunArgs=(\ --rm \ - --runtime="${docker_build_runtime}" \ + --runtime="${DOCKER_RUNTIME}" \ -v "${images_dir}:${images_dir}" \ -v "${script_dir}/..":"${tmp_dir}" \ -v "${tmp_rootfs}:${tmp_rootfs}" \ From 0e6a12ce3cf6a15170b4bfaacd969df713f23658 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:12:36 -0500 Subject: [PATCH 05/17] tests: Pass DOCKER_RUNTIME to osbuilder scripts The rootfs and image builder scripts are wired up to handle the DOCKER_RUNTIME, so pass our value down to those scripts Signed-off-by: Cole Robinson --- tests/test_images.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 6eafd71066..ac24313418 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -494,6 +494,7 @@ test_distros() get_distros_config "$distro" local commonMakeVars=( \ USE_DOCKER=true \ + DOCKER_RUNTIME="${DOCKER_RUNTIME}" \ ROOTFS_BUILD_DEST="$tmp_rootfs" \ IMAGES_BUILD_DEST="$images_dir" \ DEBUG=1 ) @@ -642,11 +643,19 @@ test_dracut() -v /etc/localtime:/etc/localtime:ro \ dracut-test-osbuilder \ ) - typeset -a makeVars=(BUILD_METHOD=dracut TARGET_INITRD="${initrd_path}" TARGET_IMAGE=${image_path} TARGET_ROOTFS=${rootfs_path}) + + typeset -a makeVars=(\ + BUILD_METHOD=dracut \ + TARGET_INITRD="${initrd_path}" \ + TARGET_IMAGE=${image_path} \ + TARGET_ROOTFS=${rootfs_path} \ + USE_DOCKER=1 \ + DOCKER_RUNTIME="${DOCKER_RUNTIME}" \ + ) info "Making image for dracut inside a container" silent_run docker run ${dockerRunArgs[@]} make -C ${tmp_dir} ${makeVars[@]} rootfs - make_image USE_DOCKER=1 ${makeVars[@]} + make_image ${makeVars[@]} local image_size=$(stat -c "%s" "${image_path}") local rootfs_size=$(get_rootfs_size "$rootfs_path") built_images["dracut"]="${rootfs_size}:${image_size}" From 555ddf331af197d5e4ae97d6944ebe7903eb0ab8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:15:13 -0500 Subject: [PATCH 06/17] tests: Remove unused USE_DOCKER export We now explicitly pass this to every make target we invoke, so this is redundant Signed-off-by: Cole Robinson --- tests/test_images.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index ac24313418..c8d9fe5f9f 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -263,8 +263,6 @@ setup() sudo -E mkdir -p ${ci_results_dir} fi - export USE_DOCKER=true - # Travis doesn't support VT-x [ -n "${TRAVIS:-}" ] && return From 1ae392285ef511e27a06ca966fbbd52a2f811b5f Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 13:36:38 -0500 Subject: [PATCH 07/17] tests: Have DEBUG=1 set bash xtrace This is similarly used in image_builder.sh and can be handy to determine what is happening. Unfold the 'set' short options while we are at it Signed-off-by: Cole Robinson --- tests/test_images.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index c8d9fe5f9f..56e9f76228 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -4,7 +4,10 @@ # # SPDX-License-Identifier: Apache-2.0 -set -euo pipefail +set -o errexit +set -o nounset +set -o pipefail +[ -n "${DEBUG:-}" ] && set -o xtrace readonly script_dir="$(dirname $(readlink -f $0))" readonly script_name=${0##*/} From 7dd99c022baeff97fc17bde39506f05ea275fe2a Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 13:47:12 -0500 Subject: [PATCH 08/17] tests: Add project_dir helper variable Rather than use ${script_dir}/.. in multiple places Signed-off-by: Cole Robinson --- tests/test_images.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 56e9f76228..dda485db54 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -11,6 +11,7 @@ set -o pipefail readonly script_dir="$(dirname $(readlink -f $0))" readonly script_name=${0##*/} +readonly project_dir="$(dirname ${script_dir})" readonly tmp_dir=$(mktemp -t -d osbuilder-test.XXXXXXX) readonly tmp_rootfs="${tmp_dir}/rootfs-osbuilder" readonly images_dir="${tmp_dir}/images" @@ -19,17 +20,17 @@ readonly docker_image="busybox" readonly systemd_docker_config_file="/etc/systemd/system/docker.service.d/kata-containers.conf" readonly sysconfig_docker_config_file="/etc/sysconfig/docker" readonly tests_repo="github.com/kata-containers/tests" -readonly tests_repo_dir="${script_dir}/../../tests" +readonly tests_repo_dir="${project_dir}/../tests" readonly mgr="${tests_repo_dir}/cmd/kata-manager/kata-manager.sh" readonly test_config=${script_dir}/test_config.sh -readonly rootfs_builder=${script_dir}/../rootfs-builder/rootfs.sh +readonly rootfs_builder=${project_dir}/rootfs-builder/rootfs.sh readonly DOCKER_RUNTIME=${DOCKER_RUNTIME:-runc} readonly RUNTIME=${RUNTIME:-kata-runtime} readonly MACHINE_TYPE=`uname -m` readonly CI=${CI:-} readonly KATA_HYPERVISOR="${KATA_HYPERVISOR:-}" readonly ci_results_dir="/var/osbuilder/tests" -readonly dracut_dir=${script_dir}/../dracut +readonly dracut_dir=${project_dir}/dracut build_images=1 build_initrds=1 @@ -47,7 +48,7 @@ typeset -A built_initrds typeset -A showKataRunFailure= source ${test_config} -source "${script_dir}/../scripts/lib.sh" +source "${project_dir}/scripts/lib.sh" usage() { @@ -639,7 +640,7 @@ test_dracut() --rm \ --runtime="${DOCKER_RUNTIME}" \ -v "${images_dir}:${images_dir}" \ - -v "${script_dir}/..":"${tmp_dir}" \ + -v "${project_dir}":"${tmp_dir}" \ -v "${tmp_rootfs}:${tmp_rootfs}" \ -v /etc/localtime:/etc/localtime:ro \ dracut-test-osbuilder \ From 7a8e816ded341418e2465300811946c0b713199c Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 13:59:08 -0500 Subject: [PATCH 09/17] tests: Specify DRACUT_OVERLAY_DIR Otherwise it defaults to using the $project_dir/dracut_overlay, which leaves junk hanging around when running the tests locally Signed-off-by: Cole Robinson --- tests/test_images.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_images.sh b/tests/test_images.sh index dda485db54..4450f4e7dd 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -622,6 +622,7 @@ test_dracut() local initrd_path="${images_dir}/kata-containers-initrd-dracut.img" local image_path="${images_dir}/kata-containers-image-dracut.img" local rootfs_path="${tmp_rootfs}/dracut_rootfs" + local overlay_path="${tmp_rootfs}/dracut_overlay" detect_go_version || die "Could not detect the required Go version for AGENT_VERSION='${AGENT_VERSION:-master}'." @@ -651,6 +652,7 @@ test_dracut() TARGET_INITRD="${initrd_path}" \ TARGET_IMAGE=${image_path} \ TARGET_ROOTFS=${rootfs_path} \ + DRACUT_OVERLAY_DIR="${overlay_path}" \ USE_DOCKER=1 \ DOCKER_RUNTIME="${DOCKER_RUNTIME}" \ ) From f3ab6d26666e48b2dfa969d964b8b91ac0fac5b5 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 14:05:12 -0500 Subject: [PATCH 10/17] tests: Don't run commands with `chronic` if DEBUG is set Don't suppress output with `chronic` when the user sets DEBUG Signed-off-by: Cole Robinson --- tests/test_images.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 4450f4e7dd..0ad6ee0295 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -230,7 +230,11 @@ silent_run() { typeset -a commandLine=("$@") info "running: ${commandLine[@]}" - chronic "${commandLine[@]}" + if [ -z "${DEBUG:-}" ]; then + chronic "${commandLine[@]}" + else + "${commandLine[@]}" + fi } From cef25917a4225e89c5fccf19b94d0379860c5ad6 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 14:14:23 -0500 Subject: [PATCH 11/17] tests: Rework dracut docker bind mounts The current setup leaves images/ and rootfs-osbuilder/ dirs stranded in the $project_dir when run locally. This simplifies things by only passing through the project_dir and the tmp_dir that all our output is relative to Signed-off-by: Cole Robinson --- tests/test_images.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 0ad6ee0295..c718df123d 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -644,9 +644,8 @@ test_dracut() typeset -a dockerRunArgs=(\ --rm \ --runtime="${DOCKER_RUNTIME}" \ - -v "${images_dir}:${images_dir}" \ - -v "${project_dir}":"${tmp_dir}" \ - -v "${tmp_rootfs}:${tmp_rootfs}" \ + -v "${project_dir}":"${project_dir}" \ + -v "${tmp_dir}":"${tmp_dir}" \ -v /etc/localtime:/etc/localtime:ro \ dracut-test-osbuilder \ ) @@ -662,7 +661,7 @@ test_dracut() ) info "Making image for dracut inside a container" - silent_run docker run ${dockerRunArgs[@]} make -C ${tmp_dir} ${makeVars[@]} rootfs + silent_run docker run ${dockerRunArgs[@]} make -C ${project_dir} ${makeVars[@]} rootfs make_image ${makeVars[@]} local image_size=$(stat -c "%s" "${image_path}") local rootfs_size=$(get_rootfs_size "$rootfs_path") @@ -672,7 +671,7 @@ test_dracut() if [ "$KATA_HYPERVISOR" != "firecracker" ]; then info "Making initrd for dracut inside a container" - silent_run docker run ${dockerRunArgs[@]} make -C ${tmp_dir} ${makeVars[@]} AGENT_INIT=yes clean initrd + silent_run docker run ${dockerRunArgs[@]} make -C ${project_dir} ${makeVars[@]} AGENT_INIT=yes clean initrd local initrd_size=$(stat -c "%s" "${initrd_path}") built_initrds["dracut"]="${rootfs_size}:${initrd_size}" install_initrd_create_container $initrd_path From e787bb0da5ffc120e2d9888189950b0c612c257e Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:23:03 -0500 Subject: [PATCH 12/17] tests: Define KATA_DEV_MODE Define KATA_DEV_MODE at the top of the file, so code doesn't need to conditionally compare against it Signed-off-by: Cole Robinson --- tests/test_images.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index c718df123d..1857e17922 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -29,6 +29,7 @@ readonly RUNTIME=${RUNTIME:-kata-runtime} readonly MACHINE_TYPE=`uname -m` readonly CI=${CI:-} readonly KATA_HYPERVISOR="${KATA_HYPERVISOR:-}" +readonly KATA_DEV_MODE="${KATA_DEV_MODE:-}" readonly ci_results_dir="/var/osbuilder/tests" readonly dracut_dir=${project_dir}/dracut @@ -276,7 +277,7 @@ setup() [ ! -d "${tests_repo_dir}" ] && git clone "https://${tests_repo}" "${tests_repo_dir}" - if [ -z "${KATA_DEV_MODE:-}" ]; then + if [ -z "${KATA_DEV_MODE}" ]; then mkdir -p /etc/kata-containers/ sudo cp -a /usr/share/defaults/kata-containers/configuration.toml /etc/kata-containers/configuration.toml else From 17a8fb13a16eabb0de261e60297f5cc7e637f388 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:25:16 -0500 Subject: [PATCH 13/17] tests: Skip all kata-manager usage if KATA_DEV_MODE is set kata-manager.sh makes host config changes. KATA_DEV_MODE is meant to avoid such changes. Add a helper run_mgr function which stubs out kata-manager.sh usage if KATA_DEV_MODE is set. Signed-off-by: Cole Robinson --- tests/test_images.sh | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 1857e17922..aea7bd5ba1 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -144,6 +144,15 @@ show_stats() rm -f "${tmpfile}" } + +# Run a kata-manager.sh command +run_mgr() +{ + [ -n "${KATA_DEV_MODE:-}" ] && return + silent_run $mgr $* +} + + exit_handler() { if [ "$?" -eq 0 ] @@ -157,7 +166,7 @@ exit_handler() rm -rf "${tmp_dir}" # Restore the default image in config file - [ -n "${TRAVIS:-}" ] || silent_run $mgr configure-image + [ -n "${TRAVIS:-}" ] || run_mgr configure-image return fi @@ -185,7 +194,7 @@ exit_handler() if [ -z "${showKataRunFailure}" ]; then # Restore the default image in config file - silent_run $mgr configure-image + run_mgr configure-image return fi @@ -202,7 +211,7 @@ exit_handler() sudo -E ps -efwww | egrep "docker|kata" >&2 # Restore the default image in config file - silent_run $mgr configure-image + run_mgr configure-image } die() @@ -289,7 +298,7 @@ setup() [ -n "$cfgRuntime" ] || die "${RUNTIME} is not a configured runtime for docker" [ -x "$cfgRuntime" ] || die "docker ${RUNTIME} is linked to an invalid executable: $cfgRuntime" fi - silent_run $mgr enable-debug + run_mgr enable-debug # "docker build" does not work with a VM-based runtime, and # also does not accept a --runtime option, so our only @@ -376,11 +385,11 @@ install_image_create_container() [ -n "${TRAVIS:-}" ] && return showKataRunFailure=1 - silent_run $mgr reset-config + run_mgr reset-config if [ "${RUST_AGENT:-}" = "yes" ]; then - silent_run $mgr enable-vsock + run_mgr enable-vsock fi - silent_run $mgr configure-image "$file" + run_mgr configure-image "$file" create_container showKataRunFailure= } @@ -396,11 +405,11 @@ install_initrd_create_container() [ -n "${TRAVIS:-}" ] && return showKataRunFailure=1 - silent_run $mgr reset-config + run_mgr reset-config if [ "${RUST_AGENT:-}" = "yes" ]; then - silent_run $mgr enable-vsock + run_mgr enable-vsock fi - silent_run $mgr configure-initrd "$file" + run_mgr configure-initrd "$file" create_container showKataRunFailure= } From 6f17b9cb48860479666d98d42c01c3068668996f Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 18:42:01 -0500 Subject: [PATCH 14/17] tests: Skip set_runtime if KATA_DEV_MODE is set set_runtime attempts to overwrite the host docker configuration to default to DOCKER_RUNTIME instead of kata-runtime, which does not work for 'docker build'. Since this is a host altering step, skip it if KATA_DEV_MODE is set. Signed-off-by: Cole Robinson --- tests/test_images.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_images.sh b/tests/test_images.sh index aea7bd5ba1..b8b7d45975 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -254,6 +254,8 @@ set_runtime() [ -z "$name" ] && die "need name" + [ -n "${KATA_DEV_MODE}" ] && return + # Travis doesn't support VT-x [ -n "${TRAVIS:-}" ] && return From 762ec28a6b70e086b280712dd91112f6562a4c63 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 1 Mar 2020 17:28:17 -0500 Subject: [PATCH 15/17] tests: Drop kata-runtime env validation if KATA_DEV_MODE is set If KATA_DEV_MODE is set, test_images.sh attempts to validate that docker has kata-runtime as a configured --runtime value. This gives a nicer and earlier error, but it also complicates using /usr/bin/docker as provided by podman, which has a different 'info' topology. Let's drop the check and let the tests fail naturally if the host isn't configured properly Signed-off-by: Cole Robinson --- tests/test_images.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index b8b7d45975..4b185a691b 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -293,12 +293,6 @@ setup() sudo cp -a /usr/share/defaults/kata-containers/configuration.toml /etc/kata-containers/configuration.toml else info "Running with KATA_DEV_MODE set, skipping installation of docker and kata packages" - # Make sure docker & kata are available - command -v docker >/dev/null || die "docker cannot be found on your PATH" - local cfgRuntime= - cfgRuntime="$(docker info --format "{{(index .Runtimes \"${RUNTIME}\").Path}}")" - [ -n "$cfgRuntime" ] || die "${RUNTIME} is not a configured runtime for docker" - [ -x "$cfgRuntime" ] || die "docker ${RUNTIME} is linked to an invalid executable: $cfgRuntime" fi run_mgr enable-debug From 0f4eac434bac96df9d53ee8a4655165b550d1dd7 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 13:57:33 -0500 Subject: [PATCH 16/17] tests: Skip initrd/image launch if KATA_DEV_MODE The script points kata-runtime at the generated initrd/image by editing the host config file, which we aren't doing when KATA_DEV_MODE=1 is set, so this won't work. Fixes: #415 Signed-off-by: Cole Robinson --- tests/test_images.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_images.sh b/tests/test_images.sh index 4b185a691b..8ccd24ba2c 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -355,6 +355,10 @@ get_distros_config() create_container() { + # If KATA_DEV_MODE is set, we don't have any way to point kata-runtime + # at the image/initrd to boot, so there's nothing to do + [ -n "${KATA_DEV_MODE}" ] && return + out=$(mktemp) local file="/proc/version" From 134175bb9bc9d3ba44ab9616d7d897e41f5157bf Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 2 Mar 2020 14:35:08 -0500 Subject: [PATCH 17/17] tests: Document the changed KATA_DEV_MODE behavior Document the KATA_DEV_MODE changes explained in the previous commits Signed-off-by: Cole Robinson --- tests/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index 068ef83015..7fb2e3b8aa 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,9 +8,15 @@ initrd images for all supported distributions and then tests them to ensure a Kata Container can be created with each. Before the build phase, the test script installs the Docker container manager -and all the Kata components required to run test containers. This step can be -skipped by setting the environment variable `KATA_DEV_MODE` to a non-empty -value. +and all the Kata components required to run test containers. Individual tests +will also alter host `kata-runtime` and `docker` service configuration as needed. + +All host config editing can be skipped by setting the environment variable +`KATA_DEV_MODE` to a non-empty value. In this mode, image/initrd targets +will be built but not runtime tested; If your host is configured to have +`kata-runtime` set as the default docker runtime, you will need to switch +to a runtime like `runc`/`crun` so the `docker build` test commands work +correctly. ``` $ ./test_images.sh