File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,14 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
159
159
return obj .Status .LastHandledReconcileAt == "now"
160
160
}, timeout ).Should (BeTrue ())
161
161
162
+ // Check if the cache contains the index.
163
+ repoKey := client.ObjectKey {Name : repository .Name , Namespace : repository .Namespace }
164
+ err = testEnv .Get (ctx , repoKey , repository )
165
+ g .Expect (err ).ToNot (HaveOccurred ())
166
+ localPath := testStorage .LocalPath (* repository .GetArtifact ())
167
+ _ , found := testCache .Get (localPath )
168
+ g .Expect (found ).To (BeTrue ())
169
+
162
170
g .Expect (testEnv .Delete (ctx , obj )).To (Succeed ())
163
171
164
172
// Wait for HelmChart to be deleted
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ var (
103
103
104
104
var (
105
105
testRegistryServer * registryClientTestServer
106
+ testCache * cache.Cache
106
107
)
107
108
108
109
func init () {
@@ -246,15 +247,15 @@ func TestMain(m *testing.M) {
246
247
panic (fmt .Sprintf ("Failed to start HelmRepositoryOCIReconciler: %v" , err ))
247
248
}
248
249
249
- c : = cache .New (5 , 1 * time .Second )
250
+ testCache = cache .New (5 , 1 * time .Second )
250
251
cacheRecorder := cache .MustMakeMetrics ()
251
252
if err := (& HelmChartReconciler {
252
253
Client : testEnv ,
253
254
EventRecorder : record .NewFakeRecorder (32 ),
254
255
Metrics : testMetricsH ,
255
256
Getters : testGetters ,
256
257
Storage : testStorage ,
257
- Cache : c ,
258
+ Cache : testCache ,
258
259
TTL : 1 * time .Second ,
259
260
CacheRecorder : cacheRecorder ,
260
261
}).SetupWithManager (testEnv ); err != nil {
Original file line number Diff line number Diff line change @@ -186,7 +186,6 @@ func (b *remoteChartBuilder) downloadFromRepository(remote *repository.ChartRepo
186
186
err = fmt .Errorf ("could not load repository index for remote chart reference: %w" , err )
187
187
return nil , & BuildError {Reason : ErrChartPull , Err : err }
188
188
}
189
- defer remote .Unload ()
190
189
191
190
// Get the current version for the RemoteReference
192
191
cv , err := remote .Get (remoteRef .Name , remoteRef .Version )
You can’t perform that action at this time.
0 commit comments