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

Function GenerateRandomStrings

pkg/util/test_util.go:18–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16)
17
18func GenerateRandomStrings() []string {
19 randomChar := "0123456789abcdef"
20 randomStrings := make([]string, 0, 1000000)
21 sb := strings.Builder{}
22 for range 1000000 {
23 sb.Reset()
24 sb.WriteString("pod://")
25 for range 14 {
26 sb.WriteByte(randomChar[rand.Int()%len(randomChar)])
27 }
28 randomStrings = append(randomStrings, sb.String())
29 }
30 return randomStrings
31}
32
33func GenerateChunk(t require.TestingT, step time.Duration, from model.Time, points int, enc promchunk.Encoding, additionalLabels ...labels.Label) chunk.Chunk {
34 var hasMetricName bool

Callers 2

initFunction · 0.92

Calls 3

WriteStringMethod · 0.80
StringMethod · 0.65
ResetMethod · 0.45

Tested by 2

initFunction · 0.74