@@ -24,7 +24,6 @@ import (
24
24
"strconv"
25
25
"time"
26
26
27
- "github.com/go-logr/logr"
28
27
. "github.com/onsi/ginkgo/v2"
29
28
. "github.com/onsi/gomega"
30
29
"helm.sh/helm/v3/pkg/action"
@@ -45,6 +44,8 @@ import (
45
44
apitypes "k8s.io/apimachinery/pkg/types"
46
45
"k8s.io/apimachinery/pkg/util/rand"
47
46
"k8s.io/cli-runtime/pkg/resource"
47
+ "k8s.io/client-go/discovery"
48
+ "k8s.io/client-go/discovery/cached/memory"
48
49
"k8s.io/client-go/rest"
49
50
"k8s.io/utils/ptr"
50
51
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -71,7 +72,7 @@ var _ = Describe("ActionClient", func() {
71
72
})
72
73
var _ = Describe ("NewActionClientGetter" , func () {
73
74
It ("should return a valid ActionConfigGetter" , func () {
74
- actionConfigGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
75
+ actionConfigGetter , err := NewActionConfigGetter (cfg , rm )
75
76
Expect (err ).ShouldNot (HaveOccurred ())
76
77
acg , err := NewActionClientGetter (actionConfigGetter )
77
78
Expect (err ).ToNot (HaveOccurred ())
@@ -88,9 +89,12 @@ var _ = Describe("ActionClient", func() {
88
89
)
89
90
BeforeEach (func () {
90
91
var err error
91
- actionConfigGetter , err = NewActionConfigGetter (cfg , rm , logr . Discard () )
92
+ actionConfigGetter , err = NewActionConfigGetter (cfg , rm )
92
93
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 , "" ))
94
98
Expect (err ).ShouldNot (HaveOccurred ())
95
99
obj = testutil .BuildTestCR (gvk )
96
100
})
@@ -110,7 +114,7 @@ var _ = Describe("ActionClient", func() {
110
114
Expect (err ).ToNot (HaveOccurred ())
111
115
Expect (acg ).NotTo (BeNil ())
112
116
113
- ac , err := acg .ActionClientFor (obj )
117
+ ac , err := acg .ActionClientFor (context . Background (), obj )
114
118
Expect (err ).ToNot (HaveOccurred ())
115
119
Expect (ac ).NotTo (BeNil ())
116
120
@@ -131,7 +135,7 @@ var _ = Describe("ActionClient", func() {
131
135
Expect (err ).ToNot (HaveOccurred ())
132
136
Expect (acg ).NotTo (BeNil ())
133
137
134
- ac , err := acg .ActionClientFor (obj )
138
+ ac , err := acg .ActionClientFor (context . Background (), obj )
135
139
Expect (err ).ToNot (HaveOccurred ())
136
140
Expect (ac ).NotTo (BeNil ())
137
141
@@ -152,7 +156,7 @@ var _ = Describe("ActionClient", func() {
152
156
Expect (err ).ToNot (HaveOccurred ())
153
157
Expect (acg ).NotTo (BeNil ())
154
158
155
- ac , err := acg .ActionClientFor (obj )
159
+ ac , err := acg .ActionClientFor (context . Background (), obj )
156
160
Expect (err ).ToNot (HaveOccurred ())
157
161
Expect (ac ).NotTo (BeNil ())
158
162
@@ -173,7 +177,7 @@ var _ = Describe("ActionClient", func() {
173
177
Expect (err ).ToNot (HaveOccurred ())
174
178
Expect (acg ).NotTo (BeNil ())
175
179
176
- ac , err := acg .ActionClientFor (obj )
180
+ ac , err := acg .ActionClientFor (context . Background (), obj )
177
181
Expect (err ).ToNot (HaveOccurred ())
178
182
Expect (ac ).NotTo (BeNil ())
179
183
@@ -194,7 +198,7 @@ var _ = Describe("ActionClient", func() {
194
198
Expect (err ).ToNot (HaveOccurred ())
195
199
Expect (acg ).NotTo (BeNil ())
196
200
197
- ac , err := acg .ActionClientFor (obj )
201
+ ac , err := acg .ActionClientFor (context . Background (), obj )
198
202
Expect (err ).ToNot (HaveOccurred ())
199
203
Expect (ac ).NotTo (BeNil ())
200
204
@@ -226,7 +230,7 @@ var _ = Describe("ActionClient", func() {
226
230
Expect (err ).ToNot (HaveOccurred ())
227
231
Expect (acg ).NotTo (BeNil ())
228
232
229
- ac , err := acg .ActionClientFor (obj )
233
+ ac , err := acg .ActionClientFor (context . Background (), obj )
230
234
Expect (err ).ToNot (HaveOccurred ())
231
235
Expect (ac ).NotTo (BeNil ())
232
236
@@ -254,7 +258,7 @@ var _ = Describe("ActionClient", func() {
254
258
Expect (err ).ToNot (HaveOccurred ())
255
259
Expect (acg ).NotTo (BeNil ())
256
260
257
- ac , err := acg .ActionClientFor (obj )
261
+ ac , err := acg .ActionClientFor (context . Background (), obj )
258
262
Expect (err ).ToNot (HaveOccurred ())
259
263
260
264
_ , err = ac .Install (obj .GetName (), obj .GetNamespace (), & chrt , chartutil.Values {})
@@ -291,11 +295,11 @@ var _ = Describe("ActionClient", func() {
291
295
expectedObj := & unstructured.Unstructured {}
292
296
expectedObj .SetGroupVersionKind (gvk )
293
297
var actualObj client.Object
294
- f := ActionClientGetterFunc (func (obj client.Object ) (ActionInterface , error ) {
298
+ f := ActionClientGetterFunc (func (_ context. Context , obj client.Object ) (ActionInterface , error ) {
295
299
actualObj = obj
296
300
return nil , nil
297
301
})
298
- _ , _ = f .ActionClientFor (expectedObj )
302
+ _ , _ = f .ActionClientFor (context . Background (), expectedObj )
299
303
Expect (actualObj .GetObjectKind ().GroupVersionKind ()).To (Equal (gvk ))
300
304
})
301
305
})
@@ -306,11 +310,11 @@ var _ = Describe("ActionClient", func() {
306
310
obj = testutil .BuildTestCR (gvk )
307
311
})
308
312
It ("should return a valid ActionClient" , func () {
309
- actionConfGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
313
+ actionConfGetter , err := NewActionConfigGetter (cfg , rm )
310
314
Expect (err ).ShouldNot (HaveOccurred ())
311
315
acg , err := NewActionClientGetter (actionConfGetter )
312
316
Expect (err ).ToNot (HaveOccurred ())
313
- ac , err := acg .ActionClientFor (obj )
317
+ ac , err := acg .ActionClientFor (context . Background (), obj )
314
318
Expect (err ).ToNot (HaveOccurred ())
315
319
Expect (ac ).NotTo (BeNil ())
316
320
})
@@ -326,11 +330,11 @@ var _ = Describe("ActionClient", func() {
326
330
BeforeEach (func () {
327
331
obj = testutil .BuildTestCR (gvk )
328
332
329
- actionConfigGetter , err := NewActionConfigGetter (cfg , rm , logr . Discard () )
333
+ actionConfigGetter , err := NewActionConfigGetter (cfg , rm )
330
334
Expect (err ).ShouldNot (HaveOccurred ())
331
335
acg , err := NewActionClientGetter (actionConfigGetter )
332
336
Expect (err ).ToNot (HaveOccurred ())
333
- ac , err = acg .ActionClientFor (obj )
337
+ ac , err = acg .ActionClientFor (context . Background (), obj )
334
338
Expect (err ).ToNot (HaveOccurred ())
335
339
336
340
cl , err = client .New (cfg , client.Options {})
0 commit comments