Skip to content

Commit aacb74d

Browse files
committed
test: pin upstream IsPodResizeInfeasible semantics as a characterization test
Upstream keys off Reason alone and ignores condition.Status, so the Status==True guard added in #2021 does not survive the move to k8s.io/component-helpers. Accepts upstream semantics and pins the difference so a future upstream tightening surfaces as a test failure rather than a silent change. Signed-off-by: gshaibi <gshaibi@nvidia.com>
1 parent c08f731 commit aacb74d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pkg/scheduler/api/pod_info/effective_requests_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ func TestEffectiveRequests_Sidecar_DownsizeInProgress(t *testing.T) {
142142
assertCPUMem(t, pod, 3000, 0)
143143
}
144144

145+
// TestIsPodResizeInfeasible characterises upstream's IsPodResizeInfeasible.
146+
//
147+
// Upstream keys off Reason alone and ignores condition.Status, so a PodResizePending
148+
// condition carrying Reason=Infeasible is treated as infeasible even when Status is
149+
// False. In practice the kubelet deletes the condition rather than setting it False,
150+
// so this is not expected to be reachable — but the case is pinned here deliberately:
151+
// if upstream ever tightens the check, this test fails and the behaviour change
152+
// surfaces instead of passing silently.
145153
func TestIsPodResizeInfeasible(t *testing.T) {
146154
tests := []struct {
147155
name string
@@ -155,9 +163,9 @@ func TestIsPodResizeInfeasible(t *testing.T) {
155163
{"Infeasible condition", []v1.PodCondition{
156164
{Type: v1.PodResizePending, Status: v1.ConditionTrue, Reason: v1.PodReasonInfeasible},
157165
}, true},
158-
{"Infeasible reason but Status not True", []v1.PodCondition{
166+
{"Infeasible reason with Status False is still infeasible upstream", []v1.PodCondition{
159167
{Type: v1.PodResizePending, Status: v1.ConditionFalse, Reason: v1.PodReasonInfeasible},
160-
}, false},
168+
}, true},
161169
}
162170
for _, tt := range tests {
163171
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)