File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 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) {
159159 return obj .Status .LastHandledReconcileAt == "now"
160160 }, timeout ).Should (BeTrue ())
161161
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+
162170 g .Expect (testEnv .Delete (ctx , obj )).To (Succeed ())
163171
164172 // Wait for HelmChart to be deleted
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ var (
103103
104104var (
105105 testRegistryServer * registryClientTestServer
106+ testCache * cache.Cache
106107)
107108
108109func init () {
@@ -246,15 +247,15 @@ func TestMain(m *testing.M) {
246247 panic (fmt .Sprintf ("Failed to start HelmRepositoryOCIReconciler: %v" , err ))
247248 }
248249
249- c : = cache .New (5 , 1 * time .Second )
250+ testCache = cache .New (5 , 1 * time .Second )
250251 cacheRecorder := cache .MustMakeMetrics ()
251252 if err := (& HelmChartReconciler {
252253 Client : testEnv ,
253254 EventRecorder : record .NewFakeRecorder (32 ),
254255 Metrics : testMetricsH ,
255256 Getters : testGetters ,
256257 Storage : testStorage ,
257- Cache : c ,
258+ Cache : testCache ,
258259 TTL : 1 * time .Second ,
259260 CacheRecorder : cacheRecorder ,
260261 }).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
186186 err = fmt .Errorf ("could not load repository index for remote chart reference: %w" , err )
187187 return nil , & BuildError {Reason : ErrChartPull , Err : err }
188188 }
189- defer remote .Unload ()
190189
191190 // Get the current version for the RemoteReference
192191 cv , err := remote .Get (remoteRef .Name , remoteRef .Version )
You can’t perform that action at this time.
0 commit comments