CI: Refactor function in install doc test

Split out a function to create a container from
`test_distro_install_guide() in the script used to test install docs.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2018-10-22 10:02:14 +01:00
parent d9c91d3723
commit 4b1839fc37

View File

@ -10,6 +10,8 @@ set -e
# golang locations.
export GOPATH=${GOPATH:-${HOME}/go}
typeset -r docker_image="busybox"
info()
{
local msg="$*"
@ -23,6 +25,17 @@ setup()
mkdir -p "${GOPATH}"
}
# Perform a simple test to create a container
create_kata_container()
{
local -r test_name="$1"
local -r msg=$(info "Successfully tested ${test_name} on distro ${ID} ${VERSION}")
# Perform a basic test
sudo -E docker run --rm -i --runtime "kata-runtime" "${docker_image}" echo "$msg"
}
# Run the kata manager to "execute" the install guide to ensure the commands
# it specified result in a working system.
test_distro_install_guide()
@ -38,10 +51,13 @@ test_distro_install_guide()
$mgr configure-image
$mgr enable-debug
msg="INFO: Successfully tested install guide for distro '$ID' $VERSION"
local mgr_name="${mgr##*/}"
# Perform a basic test
sudo -E docker run --rm -i --runtime "kata-runtime" busybox echo "$msg"
local test_name="${mgr_name} to test install guide"
info "Install using ${test_name}"
create_kata_container "${test_name}"
}
run_tests()