From 1d21e60e1221a4c03e2c8a89cf37b4ab878480ca Mon Sep 17 00:00:00 2001 From: sivchari Date: Wed, 18 Sep 2024 20:53:19 +0900 Subject: [PATCH] fix: test Signed-off-by: sivchari --- .../controllerutil/controllerutil_test.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkg/controller/controllerutil/controllerutil_test.go b/pkg/controller/controllerutil/controllerutil_test.go index 8544abce46..c275d3d2dd 100644 --- a/pkg/controller/controllerutil/controllerutil_test.go +++ b/pkg/controller/controllerutil/controllerutil_test.go @@ -967,8 +967,7 @@ var _ = Describe("Controllerutil", func() { ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "foo-uid"}, } Expect(controllerutil.SetOwnerReference(dep, rs, scheme.Scheme)).ToNot(HaveOccurred()) - - b, err := controllerutil.HasOwnerReference(dep.GetOwnerReferences(), rs, scheme.Scheme) + b, err := controllerutil.HasOwnerReference(rs.GetOwnerReferences(), dep, scheme.Scheme) Expect(err).NotTo(HaveOccurred()) Expect(b).To(BeTrue()) }) @@ -980,18 +979,10 @@ var _ = Describe("Controllerutil", func() { dep := &extensionsv1beta1.Deployment{ ObjectMeta: metav1.ObjectMeta{Name: "foo", UID: "foo-uid"}, } - b, err := controllerutil.HasOwnerReference(dep.GetOwnerReferences(), rs, scheme.Scheme) + b, err := controllerutil.HasOwnerReference(rs.GetOwnerReferences(), dep, scheme.Scheme) Expect(err).NotTo(HaveOccurred()) Expect(b).To(BeFalse()) }) - - It("should return error if the object can not create group-version-kind", func() { - rs := &appsv1.ReplicaSet{} - dep := &errMetaObj{} - b, err := controllerutil.HasOwnerReference(dep.GetOwnerReferences(), rs, runtime.NewScheme()) - Expect(err).To(HaveOccurred()) - Expect(b).To(BeFalse()) - }) }) }) })