(t *testing.T, client *Client, key string, start, end int, sleep time.Duration)
| 16 | ) |
| 17 | |
| 18 | func 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 | |
| 33 | func TestWatchKeyWithRateLimit(t *testing.T) { |
| 34 | c, closer := NewInMemoryClientWithConfig(codec.String{}, Config{ |
no test coverage detected