From bcfd48c29e4edbba149142689f04b893f5e46f81 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Fri, 5 Apr 2019 11:59:23 +0200 Subject: [PATCH] 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. --- pkg/controller/podautoscaler/legacy_horizontal_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/controller/podautoscaler/legacy_horizontal_test.go b/pkg/controller/podautoscaler/legacy_horizontal_test.go index dfcda2e294d..8b42fe9a8ed 100644 --- a/pkg/controller/podautoscaler/legacy_horizontal_test.go +++ b/pkg/controller/podautoscaler/legacy_horizontal_test.go @@ -472,7 +472,11 @@ func (tc *legacyTestCase) runTest(t *testing.T) { if tc.finished { return true, &v1.Event{}, nil } - obj := action.(core.CreateAction).GetObject().(*v1.Event) + create, ok := action.(core.CreateAction) + if !ok { + return false, nil, nil + } + obj := create.GetObject().(*v1.Event) if tc.verifyEvents { switch obj.Reason { case "SuccessfulRescale":