Skip to content

Commit

Permalink
fix: Repo-server has silent unmarshalling errors leading to empty app…
Browse files Browse the repository at this point in the history
…lications (#4423)
  • Loading branch information
jgwest committed Oct 29, 2020
1 parent a050632 commit 957f705
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions reposerver/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func TestCachedManifestResponse_HashBehavior(t *testing.T) {

inMemCache := cacheutil.NewInMemoryCache(1 * time.Hour)

thing := NewCache(
repoCache := NewCache(
cacheutil.NewCache(inMemCache),
1*time.Minute,
)
Expand All @@ -151,7 +151,10 @@ func TestCachedManifestResponse_HashBehavior(t *testing.T) {
NumberOfCachedResponsesReturned: 0,
NumberOfConsecutiveFailures: 0,
}
thing.SetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, store)
err := repoCache.SetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, store)
if err != nil {
t.Fatal(err)
}

// Get the cache entry of the set value directly from the in memory cache, and check the values
var cacheKey string
Expand Down Expand Up @@ -179,7 +182,7 @@ func TestCachedManifestResponse_HashBehavior(t *testing.T) {

// Retrieve the value using 'GetManifests' and confirm it works
retrievedVal := &CachedManifestResponse{}
err := thing.GetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, retrievedVal)
err = repoCache.GetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, retrievedVal)
if err != nil {
t.Fatal(err)
}
Expand All @@ -202,7 +205,7 @@ func TestCachedManifestResponse_HashBehavior(t *testing.T) {

// Retrieve the value using GetManifests and confirm it returns a cache miss
retrievedVal = &CachedManifestResponse{}
err = thing.GetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, retrievedVal)
err = repoCache.GetManifests(response.Revision, appSrc, response.Namespace, appKey, appValue, retrievedVal)

assert.True(t, err == cacheutil.ErrCacheMiss)

Expand Down

0 comments on commit 957f705

Please sign in to comment.