mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-17 06:14:26 +01:00
The default `kata` runtime class would get created with the `kata` handler instead of `kata-$KATA_HYPERVISOR`. This made Kata use the wrong hypervisor and broke CI. Fixes: #7663 Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
39 lines
1.2 KiB
Bash
39 lines
1.2 KiB
Bash
#!/usr/bin/env bats
|
|
#
|
|
# Copyright (c) 2023 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
load "${BATS_TEST_DIRNAME}/../../common.bash"
|
|
load "${BATS_TEST_DIRNAME}/tests_common.sh"
|
|
|
|
setup() {
|
|
# We expect 2 runtime classes because:
|
|
# * `kata` is the default runtimeclass created, basically an alias for `kata-${KATA_HYPERVISOR}`.
|
|
# * `kata-${KATA_HYPERVISOR}` is the other one
|
|
# * As part of the tests we're only deploying the specific runtimeclass that will be used, instead of all of them.
|
|
expected_runtime_classes=2
|
|
|
|
# We expect both runtime classes to have the same handler: kata-${KATA_HYPERVISOR}
|
|
expected_handlers_re=( \
|
|
"kata\s+kata-${KATA_HYPERVISOR}" \
|
|
"kata-${KATA_HYPERVISOR}\s+kata-${KATA_HYPERVISOR}" \
|
|
)
|
|
}
|
|
|
|
@test "Test runtimeclasses are being properly created" {
|
|
# We filter `kata-mshv-vm-isolation` out as that's present on AKS clusters, but that's not coming from kata-deploy
|
|
current_runtime_classes=$(kubectl get runtimeclasses | grep -v "kata-mshv-vm-isolation" | grep "kata" | wc -l)
|
|
[[ ${current_runtime_classes} -eq ${expected_runtime_classes} ]]
|
|
|
|
for handler_re in ${expected_handlers_re[@]}
|
|
do
|
|
[[ $(kubectl get runtimeclass | grep -E "${handler_re}") ]]
|
|
done
|
|
}
|
|
|
|
teardown() {
|
|
kubectl get runtimeclasses
|
|
}
|