MCPcopy Create free account
hub / github.com/cortexproject/cortex / TestAddIngesterReplacesExistingTokens

Function TestAddIngesterReplacesExistingTokens

pkg/ring/ring_test.go:208–224  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestAddIngesterReplacesExistingTokens(t *testing.T) {
209 r := NewDesc()
210
211 const ing1Name = "ing1"
212
213 // old tokens will be replaced
214 r.Ingesters[ing1Name] = InstanceDesc{
215 Tokens: []uint32{11111, 22222, 33333},
216 }
217
218 g := RandomTokenGenerator{}
219 newTokens := g.GenerateTokens(r, ing1Name, "zone", 128, true)
220
221 r.AddIngester(ing1Name, "addr", "1", newTokens, ACTIVE, time.Now())
222
223 require.Equal(t, newTokens, r.Ingesters[ing1Name].Tokens)
224}
225
226func TestRing_Get_ZoneAwarenessWithIngesterLeaving(t *testing.T) {
227 const testCount = 10000

Callers

nothing calls this directly

Calls 4

GenerateTokensMethod · 0.95
AddIngesterMethod · 0.95
NewDescFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected