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 <manuelh@nvidia.com>
Assisted-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Manuel Huber
2026-06-08 22:34:04 +00:00
parent a4138794ea
commit f37fb18b8c

View File

@@ -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() {