diff --git a/tests/hypervisor_helpers.sh b/tests/hypervisor_helpers.sh index 5ca610d6a9..24575a55fa 100644 --- a/tests/hypervisor_helpers.sh +++ b/tests/hypervisor_helpers.sh @@ -13,6 +13,19 @@ TEE_HYPERVISORS=("${SNP_HYPERVISORS[@]}" "${TDX_HYPERVISORS[@]}" "${SE_HYPERVISO NON_TEE_HYPERVISORS=("qemu-coco-dev" "qemu-coco-dev-runtime-rs") FIRECRACKER_HYPERVISORS=("firecracker" "fc") +ALL_HYPERVISORS=( + "clh" + "clh-runtime-rs" + "dragonball" + "qemu" + "qemu-runtime-rs" + "qemu-nvidia-gpu" + "qemu-nvidia-gpu-runtime-rs" + "${TEE_HYPERVISORS[@]}" + "${NON_TEE_HYPERVISORS[@]}" + "${FIRECRACKER_HYPERVISORS[@]}" +) + function is_snp_hypervisor() { local hypervisor="${1:-${KATA_HYPERVISOR}}" # shellcheck disable=SC2076 # intentionally use literal string matching @@ -62,6 +75,13 @@ function is_firecracker_hypervisor() { return 1 } +function is_supported_hypervisor() { + local hypervisor="${1:-${KATA_HYPERVISOR}}" + # shellcheck disable=SC2076 # intentionally use literal string matching + [[ " ${ALL_HYPERVISORS[*]} " =~ " ${hypervisor} " ]] && return 0 + return 1 +} + # Common check for confidential hardware (TEE) runtime class. function is_confidential_hardware() { local hypervisor="${1:-${KATA_HYPERVISOR}}" diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index c95855b8a5..cad601edcb 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -177,6 +177,11 @@ function deploy_coco_kbs() { function deploy_kata() { platform="${1:-}" + if ! is_supported_hypervisor "${KATA_HYPERVISOR}" ; then + # shellcheck disable=SC2154 + die "Unsupported KATA_HYPERVISOR=${KATA_HYPERVISOR}. Supported values: ${ALL_HYPERVISORS[*]}" + fi + [[ "${platform}" = "kcli" ]] && \ export KUBECONFIG="${HOME}/.kcli/clusters/${CLUSTER_NAME:-kata-k8s}/auth/kubeconfig"