(t *testing.T, client *Client, key string, timeout time.Duration)
| 209 | } |
| 210 | |
| 211 | func observeValueForSomeTime(t *testing.T, client *Client, key string, timeout time.Duration) []string { |
| 212 | t.Helper() |
| 213 | |
| 214 | observed := []string(nil) |
| 215 | ctx, cancel := context.WithTimeout(context.Background(), timeout) |
| 216 | defer cancel() |
| 217 | client.WatchKey(ctx, key, func(i any) bool { |
| 218 | s, ok := i.(string) |
| 219 | if !ok { |
| 220 | return false |
| 221 | } |
| 222 | t.Log("ts", time.Now(), "msg", "observed value", "val", s) |
| 223 | observed = append(observed, s) |
| 224 | return true |
| 225 | }) |
| 226 | return observed |
| 227 | } |
| 228 | |
| 229 | func TestWatchKeyWithNoStartValue(t *testing.T) { |
| 230 | c, closer := NewInMemoryClient(codec.String{}, testLogger{}, prometheus.NewPedanticRegistry()) |
no test coverage detected