storage/kubernetes: fix hash initialization bug

This commit is contained in:
Eric Chiang
2017-02-24 12:55:04 -08:00
parent 25b902b0c2
commit 1da2ae279c
2 changed files with 17 additions and 3 deletions

View File

@@ -29,6 +29,19 @@ func TestIDToName(t *testing.T) {
wg.Wait()
}
func TestOfflineTokenName(t *testing.T) {
h := func() hash.Hash { return fnv.New64() }
userID1 := "john"
userID2 := "jane"
id1 := offlineTokenName(userID1, "local", h)
id2 := offlineTokenName(userID2, "local", h)
if id1 == id2 {
t.Errorf("expected offlineTokenName to produce different hashes")
}
}
func TestNamespaceFromServiceAccountJWT(t *testing.T) {
namespace, err := namespaceFromServiceAccountJWT(serviceAccountToken)
if err != nil {