remove unneeded references

Kubernetes-commit: 2831f9a343ec405efce60d09da482a654971018e
This commit is contained in:
Daniel Smith 2022-03-17 18:35:00 +00:00 committed by Kubernetes Publisher
parent c012194d06
commit 14e253c7f8

View File

@ -26,8 +26,8 @@ import (
) )
func TestOriginalObjectCaptured(t *testing.T) { func TestOriginalObjectCaptured(t *testing.T) {
// this ReactionFunc sets the resources ClusterName // this ReactionFunc sets the resources SelfLink
const testClusterName = "some-value" const testSelfLink = "some-value"
reactors := []ReactionFunc{ reactors := []ReactionFunc{
func(action Action) (bool, runtime.Object, error) { func(action Action) (bool, runtime.Object, error) {
createAction := action.(CreateActionImpl) createAction := action.(CreateActionImpl)
@ -37,7 +37,7 @@ func TestOriginalObjectCaptured(t *testing.T) {
} }
// set any field on the resource // set any field on the resource
accessor.SetClusterName(testClusterName) accessor.SetSelfLink(testSelfLink)
return true, createAction.Object, nil return true, createAction.Object, nil
}, },
@ -69,7 +69,7 @@ func TestOriginalObjectCaptured(t *testing.T) {
} }
// validate that the returned resource was modified by the ReactionFunc // validate that the returned resource was modified by the ReactionFunc
if accessor.GetClusterName() != testClusterName { if accessor.GetSelfLink() != testSelfLink {
t.Errorf("expected resource returned by Invokes to be modified by the ReactionFunc") t.Errorf("expected resource returned by Invokes to be modified by the ReactionFunc")
} }
// verify one action was performed // verify one action was performed
@ -83,14 +83,14 @@ func TestOriginalObjectCaptured(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if accessor.GetClusterName() != "" { if accessor.GetSelfLink() != "" {
t.Errorf("expected Action recorded to not be modified by ReactionFunc but it was") t.Errorf("expected Action recorded to not be modified by ReactionFunc but it was")
} }
} }
func TestReactorChangesPersisted(t *testing.T) { func TestReactorChangesPersisted(t *testing.T) {
// this ReactionFunc sets the resources ClusterName // this ReactionFunc sets the resources SelfLink
const testClusterName = "some-value" const testSelfLink = "some-value"
reactors := []ReactionFunc{ reactors := []ReactionFunc{
func(action Action) (bool, runtime.Object, error) { func(action Action) (bool, runtime.Object, error) {
createAction := action.(CreateActionImpl) createAction := action.(CreateActionImpl)
@ -100,7 +100,7 @@ func TestReactorChangesPersisted(t *testing.T) {
} }
// set any field on the resource // set any field on the resource
accessor.SetClusterName(testClusterName) accessor.SetSelfLink(testSelfLink)
return false, createAction.Object, nil return false, createAction.Object, nil
}, },
@ -111,8 +111,8 @@ func TestReactorChangesPersisted(t *testing.T) {
return false, nil, err return false, nil, err
} }
// ensure the clusterName is set to testClusterName already // ensure the selfLink is set to testSelfLink already
if accessor.GetClusterName() != testClusterName { if accessor.GetSelfLink() != testSelfLink {
t.Errorf("expected resource passed to second reactor to be modified by first reactor") t.Errorf("expected resource passed to second reactor to be modified by first reactor")
} }
@ -146,7 +146,7 @@ func TestReactorChangesPersisted(t *testing.T) {
} }
// validate that the returned resource was modified by the ReactionFunc // validate that the returned resource was modified by the ReactionFunc
if accessor.GetClusterName() != testClusterName { if accessor.GetSelfLink() != testSelfLink {
t.Errorf("expected resource returned by Invokes to be modified by the ReactionFunc") t.Errorf("expected resource returned by Invokes to be modified by the ReactionFunc")
} }
// verify one action was performed // verify one action was performed
@ -160,7 +160,7 @@ func TestReactorChangesPersisted(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if accessor.GetClusterName() != "" { if accessor.GetSelfLink() != "" {
t.Errorf("expected Action recorded to not be modified by ReactionFunc but it was") t.Errorf("expected Action recorded to not be modified by ReactionFunc but it was")
} }
} }