MCPcopy
hub / github.com/grafana/dskit / TestRandomTokenGenerator_IgnoresOldTokens

Function TestRandomTokenGenerator_IgnoresOldTokens

ring/token_generator_test.go:20–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18}
19
20func TestRandomTokenGenerator_IgnoresOldTokens(t *testing.T) {
21 tokenGenerator := NewRandomTokenGenerator()
22 first := tokenGenerator.GenerateTokens(1000000, nil)
23 second := tokenGenerator.GenerateTokens(1000000, first)
24
25 dups := make(map[uint32]bool)
26
27 for _, v := range first {
28 dups[v] = true
29 }
30
31 for _, v := range second {
32 if dups[v] {
33 t.Fatal("GenerateTokens returned old token")
34 }
35 }
36}

Callers

nothing calls this directly

Calls 3

GenerateTokensMethod · 0.95
NewRandomTokenGeneratorFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected