Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
Adds a test to illustrate bug with listing deleted secrets with no co…
Browse files Browse the repository at this point in the history
…ntent.
  • Loading branch information
alokmenghrajani committed Jul 12, 2016
1 parent 3b0fa88 commit 7afb609
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cache_test.go
Expand Up @@ -375,6 +375,25 @@ func TestCacheSecretListDoesNotOverrideWithEmptyContent(t *testing.T) {
assert.Equal(1, cache.Len())
}

func TestCacheSecretListDoesNotReturnDeletedEmptyContentSecrets(t *testing.T) {
assert := assert.New(t)

secretFixture, _ := ParseSecret(fixture("secret.json"))
secretFixture.Content = []byte{}

fake_clock := time.Now()
cache := NewCache(DeletedBackend{}, timeouts, logConfig, func() time.Time { return fake_clock })
secret, ok := cache.Secret(secretFixture.Name)
assert.False(ok)
assert.Nil(secret)

cache.Add(*secretFixture)

list := cache.SecretList()
assert.Len(list, 0)
}


// An interesting test to write might be a combination of data being returned and deleted.
// E.g.
// Get content A.
Expand Down

0 comments on commit 7afb609

Please sign in to comment.