(t *testing.T, client *Client, key string, timeout time.Duration)
| 131 | } |
| 132 | |
| 133 | func observeValueForSomeTime(t *testing.T, client *Client, key string, timeout time.Duration) []string { |
| 134 | t.Helper() |
| 135 | |
| 136 | observed := []string(nil) |
| 137 | ctx, cancel := context.WithTimeout(context.Background(), timeout) |
| 138 | defer cancel() |
| 139 | client.WatchKey(ctx, key, func(i interface{}) bool { |
| 140 | s, ok := i.(string) |
| 141 | if !ok { |
| 142 | return false |
| 143 | } |
| 144 | t.Log("ts", time.Now(), "msg", "observed value", "val", s) |
| 145 | observed = append(observed, s) |
| 146 | return true |
| 147 | }) |
| 148 | return observed |
| 149 | } |
| 150 | |
| 151 | func TestWatchKeyWithNoStartValue(t *testing.T) { |
| 152 | c, closer := NewInMemoryClient(codec.String{}, testLogger{}, prometheus.NewPedanticRegistry()) |
no test coverage detected