diff --git a/go.mod b/go.mod index b106d4e0..aef6678d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( go.uber.org/zap v1.26.0 golang.org/x/oauth2 v0.16.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 - gotest.tools v2.2.0+incompatible k8s.io/api v0.29.1 k8s.io/apimachinery v0.29.1 k8s.io/client-go v0.29.1 diff --git a/go.sum b/go.sum index 44ef1587..635bce6e 100644 --- a/go.sum +++ b/go.sum @@ -297,8 +297,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= k8s.io/apiextensions-apiserver v0.29.1 h1:S9xOtyk9M3Sk1tIpQMu9wXHm5O2MX6Y1kIpPMimZBZw= diff --git a/internal/controller/object/object_test.go b/internal/controller/object/object_test.go index 048deb4d..c6cb55a6 100644 --- a/internal/controller/object/object_test.go +++ b/internal/controller/object/object_test.go @@ -816,9 +816,9 @@ func Test_helmExternal_Update(t *testing.T) { args: args{ mg: kubernetesObject(), client: resource.ClientApplicator{ - Applicator: resource.ApplyFn(func(context.Context, client.Object, ...resource.ApplyOption) error { - return errBoom - }), + Client: &test.MockClient{ + MockUpdate: test.NewMockUpdateFn(errBoom), + }, }, }, want: want{ @@ -829,16 +829,18 @@ func Test_helmExternal_Update(t *testing.T) { args: args{ mg: kubernetesObject(func(obj *v1alpha2.Object) { obj.Spec.ForProvider.Manifest.Raw = []byte(`{ - "apiVersion": "v1", - "kind": "Namespace" }`) + "apiVersion": "v1", + "kind": "Namespace" }`) }), client: resource.ClientApplicator{ - Applicator: resource.ApplyFn(func(ctx context.Context, obj client.Object, op ...resource.ApplyOption) error { - if obj.GetName() != testObjectName { - t.Errorf("Name should default to object name when not provider in manifest") - } - return nil - }), + Client: &test.MockClient{ + MockUpdate: test.NewMockUpdateFn(nil, func(obj client.Object) error { + if obj.GetName() != testObjectName { + t.Errorf("Name should default to object name when not provider in manifest") + } + return nil + }), + }, }, }, want: want{ @@ -849,9 +851,15 @@ func Test_helmExternal_Update(t *testing.T) { args: args{ mg: kubernetesObject(), client: resource.ClientApplicator{ - Applicator: resource.ApplyFn(func(context.Context, client.Object, ...resource.ApplyOption) error { - return nil - }), + Client: &test.MockClient{ + MockUpdate: test.NewMockUpdateFn(nil, func(obj client.Object) error { + _, ok := obj.GetAnnotations()[corev1.LastAppliedConfigAnnotation] + if !ok { + t.Errorf("Last applied annotation not set with create") + } + return nil + }), + }, }, }, want: want{