(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestWatchKeyNoRateLimit(t *testing.T) { |
| 147 | c, closer := NewInMemoryClientWithConfig(codec.String{}, Config{ |
| 148 | WatchKeyRateLimit: 0, |
| 149 | }, testLogger{}, prometheus.NewPedanticRegistry()) |
| 150 | t.Cleanup(func() { |
| 151 | assert.NoError(t, closer.Close()) |
| 152 | }) |
| 153 | |
| 154 | const key = "test" |
| 155 | const max = 100 |
| 156 | |
| 157 | ch := writeValuesToKV(t, c, key, 0, max, time.Millisecond) |
| 158 | observed := observeValueForSomeTime(t, c, key, 500*time.Millisecond) |
| 159 | |
| 160 | // wait until updater finishes |
| 161 | <-ch |
| 162 | |
| 163 | // With no limit, we should see most written values (we can lose some values if watching |
| 164 | // code is busy while multiple new values are written) |
| 165 | if len(observed) < 3*max/4 { |
| 166 | t.Error("Expected at least 3/4 of all values, got", observed) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func TestReset(t *testing.T) { |
| 171 | c, closer := NewInMemoryClient(codec.String{}, testLogger{}, prometheus.NewPedanticRegistry()) |
nothing calls this directly
no test coverage detected