From 0352f1e02964d3b10a1306f4c2e079cb4137d834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 3 Nov 2023 12:09:45 +0100 Subject: [PATCH] kata-manager: Allow passing a specific tool to test_installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now we're only testing with `ctr` and there's no change in behaviour with this commit. However, allowing to pass a tool to run the tests with gives us an easier time when expanding kata-manager to support, for instance, docker and nerdctl. Signed-off-by: Fabiano FidĂȘncio --- utils/kata-manager.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/kata-manager.sh b/utils/kata-manager.sh index a41f22e249..4973114951 100755 --- a/utils/kata-manager.sh +++ b/utils/kata-manager.sh @@ -722,19 +722,22 @@ handle_containerd() test_installation() { + local tool="${1:-}" + [ -z "$tool" ] && die "The tool to test $kata_project with was not informed" + info "Testing $kata_project\n" sudo kata-runtime check -v local image="docker.io/library/busybox:latest" - sudo ctr image pull "$image" + sudo $tool image pull "$image" local container_name="test-kata" # Used to prove that the kernel in the container # is different to the host kernel. local container_kernel - container_kernel=$(sudo ctr run \ + container_kernel=$(sudo $tool run \ --runtime "$kata_runtime_type" \ --rm \ "$image" \ @@ -777,7 +780,10 @@ handle_installation() local kata_version="${7:-}" local containerd_flavour="${8:-}" - [ "$only_run_test" = "true" ] && test_installation && return 0 + # The tool to be testing the installation with + local tool="ctr" + + [ "$only_run_test" = "true" ] && test_installation "$tool" && return 0 setup "$cleanup" "$force" "$skip_containerd" @@ -789,7 +795,7 @@ handle_installation() "$force" \ "$enable_debug" - [ "$disable_test" = "false" ] && test_installation + [ "$disable_test" = "false" ] && test_installation "$tool" if [ "$skip_containerd" = "true" ] then