From f37fb18b8c3d6cd7ec335af7ee3ebeadc017f192 Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Mon, 8 Jun 2026 22:34:04 +0000 Subject: [PATCH] tests: fix k8s-number-cpus expectation As pointed out in kata-containers/kata-containers#12961, the k8s-number-cpus retry loop could fail all retried assertions and still pass. k8s-number-cpus retried until the guest reported three CPUs, but the post-loop result was never checked. Bash suppresses errexit for the equality test before && break, so the test could exhaust retries and still pass. The current kata-qemu handler sizes vCPUs from fractional container quotas: two 500m limits produce one workload vCPU, then the default vCPU is added and rounded once. Expect two CPUs and assert the final retry result so the test fails if the count never converges. Signed-off-by: Manuel Huber Assisted-by: OpenAI Codex --- tests/integration/kubernetes/k8s-number-cpus.bats | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/kubernetes/k8s-number-cpus.bats b/tests/integration/kubernetes/k8s-number-cpus.bats index 2417550ce4..8d0d1199ae 100644 --- a/tests/integration/kubernetes/k8s-number-cpus.bats +++ b/tests/integration/kubernetes/k8s-number-cpus.bats @@ -31,7 +31,7 @@ setup() { # Skip on aarch64 due to missing cpu hotplug related functionality. @test "Check number of cpus" { local -r retries="10" - local -r max_number_cpus="3" + local -r max_number_cpus="2" local number_cpus="" # Create pod @@ -50,6 +50,8 @@ setup() { fi sleep 1 done + + [ "$number_cpus" -eq "$max_number_cpus" ] } teardown() {