From 5833e7e87755fd71927f21c5276fc2b9aea4e903 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Wed, 17 May 2023 23:38:17 -0700 Subject: [PATCH] address comment Signed-off-by: Ben Ye --- pkg/store/cache/cache_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/store/cache/cache_test.go b/pkg/store/cache/cache_test.go index cd04fd56fb1..889009259bb 100644 --- a/pkg/store/cache/cache_test.go +++ b/pkg/store/cache/cache_test.go @@ -26,14 +26,14 @@ func TestCacheKey_string(t *testing.T) { t.Parallel() uid := ulid.MustNew(1, nil) - uidStr := uid.String() + ulidString := uid.String() tests := map[string]struct { key cacheKey expected string }{ "should stringify postings cache key": { - key: cacheKey{uidStr, cacheKeyPostings(labels.Label{Name: "foo", Value: "bar"})}, + key: cacheKey{ulidString, cacheKeyPostings(labels.Label{Name: "foo", Value: "bar"})}, expected: func() string { hash := blake2b.Sum256([]byte("foo:bar")) encodedHash := base64.RawURLEncoding.EncodeToString(hash[0:]) @@ -42,7 +42,7 @@ func TestCacheKey_string(t *testing.T) { }(), }, "should stringify series cache key": { - key: cacheKey{uidStr, cacheKeySeries(12345)}, + key: cacheKey{ulidString, cacheKeySeries(12345)}, expected: fmt.Sprintf("S:%s:12345", uid.String()), }, } @@ -59,7 +59,7 @@ func TestCacheKey_string_ShouldGuaranteeReasonablyShortKeyLength(t *testing.T) { t.Parallel() uid := ulid.MustNew(1, nil) - uidStr := uid.String() + ulidString := uid.String() tests := map[string]struct { keys []cacheKey @@ -68,14 +68,14 @@ func TestCacheKey_string_ShouldGuaranteeReasonablyShortKeyLength(t *testing.T) { "should guarantee reasonably short key length for postings": { expectedLen: 72, keys: []cacheKey{ - {uidStr, cacheKeyPostings(labels.Label{Name: "a", Value: "b"})}, - {uidStr, cacheKeyPostings(labels.Label{Name: strings.Repeat("a", 100), Value: strings.Repeat("a", 1000)})}, + {ulidString, cacheKeyPostings(labels.Label{Name: "a", Value: "b"})}, + {ulidString, cacheKeyPostings(labels.Label{Name: strings.Repeat("a", 100), Value: strings.Repeat("a", 1000)})}, }, }, "should guarantee reasonably short key length for series": { expectedLen: 49, keys: []cacheKey{ - {uidStr, cacheKeySeries(math.MaxUint64)}, + {ulidString, cacheKeySeries(math.MaxUint64)}, }, }, }