fix static check failures in staging pkg

Kubernetes-commit: d3578f465d1e41f6fb022f64117f51cbed90fd9d
This commit is contained in:
carlory 2019-08-26 21:23:40 +08:00 committed by Kubernetes Publisher
parent b2dd2e61ff
commit bf70b19355

View File

@ -175,8 +175,8 @@ func checkAction(expected, actual core.Action, t *testing.T) {
} }
switch a := actual.(type) { switch a := actual.(type) {
case core.CreateAction: case core.CreateActionImpl:
e, _ := expected.(core.CreateAction) e, _ := expected.(core.CreateActionImpl)
expObject := e.GetObject() expObject := e.GetObject()
object := a.GetObject() object := a.GetObject()
@ -184,8 +184,8 @@ func checkAction(expected, actual core.Action, t *testing.T) {
t.Errorf("Action %s %s has wrong object\nDiff:\n %s", t.Errorf("Action %s %s has wrong object\nDiff:\n %s",
a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object))
} }
case core.UpdateAction: case core.UpdateActionImpl:
e, _ := expected.(core.UpdateAction) e, _ := expected.(core.UpdateActionImpl)
expObject := e.GetObject() expObject := e.GetObject()
object := a.GetObject() object := a.GetObject()
@ -193,8 +193,8 @@ func checkAction(expected, actual core.Action, t *testing.T) {
t.Errorf("Action %s %s has wrong object\nDiff:\n %s", t.Errorf("Action %s %s has wrong object\nDiff:\n %s",
a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object)) a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expObject, object))
} }
case core.PatchAction: case core.PatchActionImpl:
e, _ := expected.(core.PatchAction) e, _ := expected.(core.PatchActionImpl)
expPatch := e.GetPatch() expPatch := e.GetPatch()
patch := a.GetPatch() patch := a.GetPatch()
@ -202,6 +202,9 @@ func checkAction(expected, actual core.Action, t *testing.T) {
t.Errorf("Action %s %s has wrong patch\nDiff:\n %s", t.Errorf("Action %s %s has wrong patch\nDiff:\n %s",
a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch)) a.GetVerb(), a.GetResource().Resource, diff.ObjectGoPrintSideBySide(expPatch, patch))
} }
default:
t.Errorf("Uncaptured Action %s %s, you should explicitly add a case to capture it",
actual.GetVerb(), actual.GetResource().Resource)
} }
} }