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

Function writeValuesToKV

kv/consul/client_test.go:18–31  ·  view source on GitHub ↗
(t *testing.T, client *Client, key string, start, end int, sleep time.Duration)

Source from the content-addressed store, hash-verified

16)
17
18func writeValuesToKV(t *testing.T, client *Client, key string, start, end int, sleep time.Duration) <-chan struct{} {
19 t.Helper()
20
21 ch := make(chan struct{})
22 go func() {
23 defer close(ch)
24 for i := start; i <= end; i++ {
25 t.Log("ts", time.Now(), "msg", "writing value", "val", i)
26 _, _ = client.kv.Put(&consul.KVPair{Key: key, Value: []byte(fmt.Sprintf("%d", i))}, nil)
27 time.Sleep(sleep)
28 }
29 }()
30 return ch
31}
32
33func TestWatchKeyWithRateLimit(t *testing.T) {
34 c, closer := NewInMemoryClientWithConfig(codec.String{}, Config{

Callers 2

TestWatchKeyNoRateLimitFunction · 0.85

Calls 4

HelperMethod · 0.80
PutMethod · 0.65
SleepMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected