Merge pull request #761 from souleb/fix-cache-regression
Fix repository cache regression
This commit is contained in:
commit
b66ff927ae
|
@ -159,6 +159,14 @@ func TestHelmChartReconciler_Reconcile(t *testing.T) {
|
|||
return obj.Status.LastHandledReconcileAt == "now"
|
||||
}, timeout).Should(BeTrue())
|
||||
|
||||
// Check if the cache contains the index.
|
||||
repoKey := client.ObjectKey{Name: repository.Name, Namespace: repository.Namespace}
|
||||
err = testEnv.Get(ctx, repoKey, repository)
|
||||
g.Expect(err).ToNot(HaveOccurred())
|
||||
localPath := testStorage.LocalPath(*repository.GetArtifact())
|
||||
_, found := testCache.Get(localPath)
|
||||
g.Expect(found).To(BeTrue())
|
||||
|
||||
g.Expect(testEnv.Delete(ctx, obj)).To(Succeed())
|
||||
|
||||
// Wait for HelmChart to be deleted
|
||||
|
|
|
@ -103,6 +103,7 @@ var (
|
|||
|
||||
var (
|
||||
testRegistryServer *registryClientTestServer
|
||||
testCache *cache.Cache
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -246,7 +247,7 @@ func TestMain(m *testing.M) {
|
|||
panic(fmt.Sprintf("Failed to start HelmRepositoryOCIReconciler: %v", err))
|
||||
}
|
||||
|
||||
c := cache.New(5, 1*time.Second)
|
||||
testCache = cache.New(5, 1*time.Second)
|
||||
cacheRecorder := cache.MustMakeMetrics()
|
||||
if err := (&HelmChartReconciler{
|
||||
Client: testEnv,
|
||||
|
@ -254,7 +255,7 @@ func TestMain(m *testing.M) {
|
|||
Metrics: testMetricsH,
|
||||
Getters: testGetters,
|
||||
Storage: testStorage,
|
||||
Cache: c,
|
||||
Cache: testCache,
|
||||
TTL: 1 * time.Second,
|
||||
CacheRecorder: cacheRecorder,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
|
|
|
@ -186,7 +186,6 @@ func (b *remoteChartBuilder) downloadFromRepository(remote *repository.ChartRepo
|
|||
err = fmt.Errorf("could not load repository index for remote chart reference: %w", err)
|
||||
return nil, &BuildError{Reason: ErrChartPull, Err: err}
|
||||
}
|
||||
defer remote.Unload()
|
||||
|
||||
// Get the current version for the RemoteReference
|
||||
cv, err := remote.Get(remoteRef.Name, remoteRef.Version)
|
||||
|
|
Loading…
Reference in New Issue