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>
This commit is contained in:
Mattia Eleuteri committed 2026-11-13 13:07:08 +01:00
1 parent e6127f7e42
commit cc412d44f2
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 {