(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestWatchKeyNoRateLimit(t *testing.T) { |
| 69 | c, closer := NewInMemoryClientWithConfig(codec.String{}, Config{ |
| 70 | WatchKeyRateLimit: 0, |
| 71 | }, testLogger{}, prometheus.NewPedanticRegistry()) |
| 72 | t.Cleanup(func() { |
| 73 | assert.NoError(t, closer.Close()) |
| 74 | }) |
| 75 | |
| 76 | const key = "test" |
| 77 | const max = 100 |
| 78 | |
| 79 | ch := writeValuesToKV(t, c, key, 0, max, time.Millisecond) |
| 80 | observed := observeValueForSomeTime(t, c, key, 500*time.Millisecond) |
| 81 | |
| 82 | // wait until updater finishes |
| 83 | <-ch |
| 84 | |
| 85 | // With no limit, we should see most written values (we can lose some values if watching |
| 86 | // code is busy while multiple new values are written) |
| 87 | if len(observed) < 3*max/4 { |
| 88 | t.Error("Expected at least 3/4 of all values, got", observed) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestReset(t *testing.T) { |
| 93 | c, closer := NewInMemoryClient(codec.String{}, testLogger{}, prometheus.NewPedanticRegistry()) |
nothing calls this directly
no test coverage detected