test(controller): exercise the missing-root-LimitRange path under a compute-limit quota

TestReconcile_PoolRootWithoutLimitRange declared its root quota on cpu,
which the compute-limit gate does not count, so the sweep never looked
for the root's LimitRange and the test passed whatever that path did.
Declaring limits.cpu makes it reach the lookup, and it now fails if a
missing root LimitRange produces an empty copy.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
(cherry picked from commit cc412d44f2)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
Mattia Eleuteri authored and Myasnikov Daniil committed 2026-11-25 09:58:10 +00:00
1 parent c1fb228489
commit ab222a9257
1 file changed
+2 -2
@@ -351,12 +351,12 @@ func TestReconcile_PoolRootWithoutLimitRange(t *testing.T) {
tenantHR("foo", "tenant-root"),
tenantHR("bar", "tenant-foo"),
ns("tenant-foo"), ns("tenant-foo-bar"),
chartQuota("tenant-foo", map[string]string{"cpu": "10"}, nil),
chartQuota("tenant-foo", map[string]string{"limits.cpu": "10"}, nil),
)
if _, err := r.Reconcile(context.Background(), sweepKey); err != nil {
t.Fatalf("reconcile: %v", err)
}
if _, ok := allocatedHard(t, c, "tenant-foo-bar", "cpu"); !ok {
if _, ok := allocatedHard(t, c, "tenant-foo-bar", "limits.cpu"); !ok {
t.Fatalf("tenant-foo-bar must still get its allocated quota")
}
if _, ok := getLimitRange(c, "tenant-foo-bar", allocatedLimitRangeName); ok {