mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 09:13:29 +00:00
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:
parent
d9c91d3723
commit
4b1839fc37
@ -10,6 +10,8 @@ set -e
|
|||||||
# golang locations.
|
# golang locations.
|
||||||
export GOPATH=${GOPATH:-${HOME}/go}
|
export GOPATH=${GOPATH:-${HOME}/go}
|
||||||
|
|
||||||
|
typeset -r docker_image="busybox"
|
||||||
|
|
||||||
info()
|
info()
|
||||||
{
|
{
|
||||||
local msg="$*"
|
local msg="$*"
|
||||||
@ -23,6 +25,17 @@ setup()
|
|||||||
mkdir -p "${GOPATH}"
|
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
|
# Run the kata manager to "execute" the install guide to ensure the commands
|
||||||
# it specified result in a working system.
|
# it specified result in a working system.
|
||||||
test_distro_install_guide()
|
test_distro_install_guide()
|
||||||
@ -38,10 +51,13 @@ test_distro_install_guide()
|
|||||||
$mgr configure-image
|
$mgr configure-image
|
||||||
$mgr enable-debug
|
$mgr enable-debug
|
||||||
|
|
||||||
msg="INFO: Successfully tested install guide for distro '$ID' $VERSION"
|
local mgr_name="${mgr##*/}"
|
||||||
|
|
||||||
# Perform a basic test
|
local test_name="${mgr_name} to test install guide"
|
||||||
sudo -E docker run --rm -i --runtime "kata-runtime" busybox echo "$msg"
|
|
||||||
|
info "Install using ${test_name}"
|
||||||
|
|
||||||
|
create_kata_container "${test_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_tests()
|
run_tests()
|
||||||
|
Loading…
Reference in New Issue
Block a user