mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
fix unfiltered comparison
This commit is contained in:
parent
ea5afb9ab7
commit
81a8efda28
@ -194,14 +194,13 @@ func (f *fixture) run(deploymentName string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions := filterInformerActions(f.client.Actions())
|
actions := filterInformerActions(f.client.Actions())
|
||||||
informerActions := 0
|
|
||||||
for i, action := range actions {
|
for i, action := range actions {
|
||||||
if len(f.actions)+informerActions < i+1 {
|
if len(f.actions) < i+1 {
|
||||||
f.t.Errorf("%d unexpected actions: %+v", len(actions)-len(f.actions), actions[i:])
|
f.t.Errorf("%d unexpected actions: %+v", len(actions)-len(f.actions), actions[i:])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedAction := f.actions[i-informerActions]
|
expectedAction := f.actions[i]
|
||||||
if !expectedAction.Matches(action.GetVerb(), action.GetResource().Resource) {
|
if !expectedAction.Matches(action.GetVerb(), action.GetResource().Resource) {
|
||||||
f.t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expectedAction, action)
|
f.t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expectedAction, action)
|
||||||
continue
|
continue
|
||||||
@ -261,10 +260,12 @@ func TestDeploymentController_dontSyncDeploymentsWithEmptyPodSelector(t *testing
|
|||||||
// We expect the deployment controller to not take action here since it's configuration
|
// We expect the deployment controller to not take action here since it's configuration
|
||||||
// is invalid, even though no replicasets exist that match it's selector.
|
// is invalid, even though no replicasets exist that match it's selector.
|
||||||
controller.syncDeployment(fmt.Sprintf("%s/%s", d.ObjectMeta.Namespace, d.ObjectMeta.Name))
|
controller.syncDeployment(fmt.Sprintf("%s/%s", d.ObjectMeta.Namespace, d.ObjectMeta.Name))
|
||||||
if len(fake.Actions()) == 0 {
|
|
||||||
|
filteredActions := filterInformerActions(fake.Actions())
|
||||||
|
if len(filteredActions) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, action := range filterInformerActions(fake.Actions()) {
|
for _, action := range filteredActions {
|
||||||
t.Logf("unexpected action: %#v", action)
|
t.Logf("unexpected action: %#v", action)
|
||||||
}
|
}
|
||||||
t.Errorf("expected deployment controller to not take action")
|
t.Errorf("expected deployment controller to not take action")
|
||||||
|
Loading…
Reference in New Issue
Block a user