Skip to content

Commit

Permalink
Fix unit tests for unstructured deepcopy
Browse files Browse the repository at this point in the history
Signed-off-by: Hasan Turken <turkenh@gmail.com>
  • Loading branch information
turkenh committed Nov 14, 2023
1 parent 041c352 commit d18ef77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/controller/apiextensions/claim/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ func TestReconcile(t *testing.T) {
var customStatusUpdate test.MockSubResourceUpdateFn
mockGet := func(ctx context.Context, key client.ObjectKey, obj client.Object) error {
if o, ok := obj.(*claim.Unstructured); ok {
tc.args.claim.DeepCopyInto(&o.Unstructured)
tc.args.claim.Unstructured.DeepCopyInto(&o.Unstructured)
return nil
}
if customGet != nil {
Expand All @@ -768,7 +768,7 @@ func TestReconcile(t *testing.T) {

mockStatusUpdate := func(ctx context.Context, obj client.Object, opts ...client.SubResourceUpdateOption) error {
if o, ok := obj.(*claim.Unstructured); ok {
o.DeepCopyInto(&tc.args.claim.Unstructured)
o.Unstructured.DeepCopyInto(&tc.args.claim.Unstructured)
}
if customStatusUpdate != nil {
return customStatusUpdate(ctx, obj, opts...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1011,14 +1011,14 @@ func TestEnqueueForCompositionRevisionFunc(t *testing.T) {
obj1.SetCompositionUpdatePolicy(&automatic)
obj1.SetCompositionReference(&corev1.ObjectReference{Name: "dachshund"})

obj2 := composite.Unstructured{Unstructured: *obj1.DeepCopy()}
obj2 := composite.Unstructured{Unstructured: *obj1.Unstructured.DeepCopy()}
obj2.SetName("obj2")

obj3 := composite.Unstructured{Unstructured: *obj1.DeepCopy()}
obj3 := composite.Unstructured{Unstructured: *obj1.Unstructured.DeepCopy()}
obj3.SetName("obj3")
obj3.SetCompositionReference(&corev1.ObjectReference{Name: "bernese"})

obj4 := composite.Unstructured{Unstructured: *obj1.DeepCopy()}
obj4 := composite.Unstructured{Unstructured: *obj1.Unstructured.DeepCopy()}
obj4.SetName("obj4")
manual := xpv1.UpdateManual
obj4.SetCompositionUpdatePolicy(&manual)
Expand Down

0 comments on commit d18ef77

Please sign in to comment.