@@ -24,7 +24,6 @@ import (
2424 "strconv"
2525 "time"
2626
27- "github.com/go-logr/logr"
2827 . "github.com/onsi/ginkgo/v2"
2928 . "github.com/onsi/gomega"
3029 "helm.sh/helm/v3/pkg/action"
@@ -45,6 +44,8 @@ import (
4544 apitypes "k8s.io/apimachinery/pkg/types"
4645 "k8s.io/apimachinery/pkg/util/rand"
4746 "k8s.io/cli-runtime/pkg/resource"
47+ "k8s.io/client-go/discovery"
48+ "k8s.io/client-go/discovery/cached/memory"
4849 "k8s.io/client-go/rest"
4950 "k8s.io/utils/ptr"
5051 "sigs.k8s.io/controller-runtime/pkg/client"
@@ -71,7 +72,7 @@ var _ = Describe("ActionClient", func() {
7172 })
7273 var _ = Describe ("NewActionClientGetter" , func () {
7374 It ("should return a valid ActionConfigGetter" , func () {
74- actionConfigGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
75+ actionConfigGetter , err := NewActionConfigGetter (cfg , rm )
7576 Expect (err ).ShouldNot (HaveOccurred ())
7677 acg , err := NewActionClientGetter (actionConfigGetter )
7778 Expect (err ).ToNot (HaveOccurred ())
@@ -88,9 +89,12 @@ var _ = Describe("ActionClient", func() {
8889 )
8990 BeforeEach (func () {
9091 var err error
91- actionConfigGetter , err = NewActionConfigGetter (cfg , rm , logr . Discard () )
92+ actionConfigGetter , err = NewActionConfigGetter (cfg , rm )
9293 Expect (err ).ShouldNot (HaveOccurred ())
93- cli = kube .New (newRESTClientGetter (cfg , rm , "" ))
94+ dc , err := discovery .NewDiscoveryClientForConfig (cfg )
95+ Expect (err ).ShouldNot (HaveOccurred ())
96+ cdc := memory .NewMemCacheClient (dc )
97+ cli = kube .New (newRESTClientGetter (cfg , rm , cdc , "" ))
9498 Expect (err ).ShouldNot (HaveOccurred ())
9599 obj = testutil .BuildTestCR (gvk )
96100 })
@@ -110,7 +114,7 @@ var _ = Describe("ActionClient", func() {
110114 Expect (err ).ToNot (HaveOccurred ())
111115 Expect (acg ).NotTo (BeNil ())
112116
113- ac , err := acg .ActionClientFor (obj )
117+ ac , err := acg .ActionClientFor (context . Background (), obj )
114118 Expect (err ).ToNot (HaveOccurred ())
115119 Expect (ac ).NotTo (BeNil ())
116120
@@ -131,7 +135,7 @@ var _ = Describe("ActionClient", func() {
131135 Expect (err ).ToNot (HaveOccurred ())
132136 Expect (acg ).NotTo (BeNil ())
133137
134- ac , err := acg .ActionClientFor (obj )
138+ ac , err := acg .ActionClientFor (context . Background (), obj )
135139 Expect (err ).ToNot (HaveOccurred ())
136140 Expect (ac ).NotTo (BeNil ())
137141
@@ -152,7 +156,7 @@ var _ = Describe("ActionClient", func() {
152156 Expect (err ).ToNot (HaveOccurred ())
153157 Expect (acg ).NotTo (BeNil ())
154158
155- ac , err := acg .ActionClientFor (obj )
159+ ac , err := acg .ActionClientFor (context . Background (), obj )
156160 Expect (err ).ToNot (HaveOccurred ())
157161 Expect (ac ).NotTo (BeNil ())
158162
@@ -173,7 +177,7 @@ var _ = Describe("ActionClient", func() {
173177 Expect (err ).ToNot (HaveOccurred ())
174178 Expect (acg ).NotTo (BeNil ())
175179
176- ac , err := acg .ActionClientFor (obj )
180+ ac , err := acg .ActionClientFor (context . Background (), obj )
177181 Expect (err ).ToNot (HaveOccurred ())
178182 Expect (ac ).NotTo (BeNil ())
179183
@@ -194,7 +198,7 @@ var _ = Describe("ActionClient", func() {
194198 Expect (err ).ToNot (HaveOccurred ())
195199 Expect (acg ).NotTo (BeNil ())
196200
197- ac , err := acg .ActionClientFor (obj )
201+ ac , err := acg .ActionClientFor (context . Background (), obj )
198202 Expect (err ).ToNot (HaveOccurred ())
199203 Expect (ac ).NotTo (BeNil ())
200204
@@ -226,7 +230,7 @@ var _ = Describe("ActionClient", func() {
226230 Expect (err ).ToNot (HaveOccurred ())
227231 Expect (acg ).NotTo (BeNil ())
228232
229- ac , err := acg .ActionClientFor (obj )
233+ ac , err := acg .ActionClientFor (context . Background (), obj )
230234 Expect (err ).ToNot (HaveOccurred ())
231235 Expect (ac ).NotTo (BeNil ())
232236
@@ -254,7 +258,7 @@ var _ = Describe("ActionClient", func() {
254258 Expect (err ).ToNot (HaveOccurred ())
255259 Expect (acg ).NotTo (BeNil ())
256260
257- ac , err := acg .ActionClientFor (obj )
261+ ac , err := acg .ActionClientFor (context . Background (), obj )
258262 Expect (err ).ToNot (HaveOccurred ())
259263
260264 _ , err = ac .Install (obj .GetName (), obj .GetNamespace (), & chrt , chartutil.Values {})
@@ -291,11 +295,11 @@ var _ = Describe("ActionClient", func() {
291295 expectedObj := & unstructured.Unstructured {}
292296 expectedObj .SetGroupVersionKind (gvk )
293297 var actualObj client.Object
294- f := ActionClientGetterFunc (func (obj client.Object ) (ActionInterface , error ) {
298+ f := ActionClientGetterFunc (func (_ context. Context , obj client.Object ) (ActionInterface , error ) {
295299 actualObj = obj
296300 return nil , nil
297301 })
298- _ , _ = f .ActionClientFor (expectedObj )
302+ _ , _ = f .ActionClientFor (context . Background (), expectedObj )
299303 Expect (actualObj .GetObjectKind ().GroupVersionKind ()).To (Equal (gvk ))
300304 })
301305 })
@@ -306,11 +310,11 @@ var _ = Describe("ActionClient", func() {
306310 obj = testutil .BuildTestCR (gvk )
307311 })
308312 It ("should return a valid ActionClient" , func () {
309- actionConfGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
313+ actionConfGetter , err := NewActionConfigGetter (cfg , rm )
310314 Expect (err ).ShouldNot (HaveOccurred ())
311315 acg , err := NewActionClientGetter (actionConfGetter )
312316 Expect (err ).ToNot (HaveOccurred ())
313- ac , err := acg .ActionClientFor (obj )
317+ ac , err := acg .ActionClientFor (context . Background (), obj )
314318 Expect (err ).ToNot (HaveOccurred ())
315319 Expect (ac ).NotTo (BeNil ())
316320 })
@@ -326,11 +330,11 @@ var _ = Describe("ActionClient", func() {
326330 BeforeEach (func () {
327331 obj = testutil .BuildTestCR (gvk )
328332
329- actionConfigGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
333+ actionConfigGetter , err := NewActionConfigGetter (cfg , rm )
330334 Expect (err ).ShouldNot (HaveOccurred ())
331335 acg , err := NewActionClientGetter (actionConfigGetter )
332336 Expect (err ).ToNot (HaveOccurred ())
333- ac , err = acg .ActionClientFor (obj )
337+ ac , err = acg .ActionClientFor (context . Background (), obj )
334338 Expect (err ).ToNot (HaveOccurred ())
335339
336340 cl , err = client .New (cfg , client.Options {})
0 commit comments