Skip to content

Commit bcfd48c

Browse files
committed
Fix flaky legacy pod autoscaler test
The reactor in runTest is set to catch all actions, but eventually it only handles CreateAction without checking action type which might fail sometimes when Patch arrives. This fix ensures we handle only the CreateAction.
1 parent 84b5610 commit bcfd48c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/controller/podautoscaler/legacy_horizontal_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,11 @@ func (tc *legacyTestCase) runTest(t *testing.T) {
472472
if tc.finished {
473473
return true, &v1.Event{}, nil
474474
}
475-
obj := action.(core.CreateAction).GetObject().(*v1.Event)
475+
create, ok := action.(core.CreateAction)
476+
if !ok {
477+
return false, nil, nil
478+
}
479+
obj := create.GetObject().(*v1.Event)
476480
if tc.verifyEvents {
477481
switch obj.Reason {
478482
case "SuccessfulRescale":

0 commit comments

Comments
 (0)