mirror of https://github.com/hashicorp/consul
Also test reload of EntryFetchMaxBurst
parent
5842a902df
commit
9a64d3e5fe
|
@ -766,15 +766,18 @@ func TestCacheRateLimit(test *testing.T) {
|
||||||
test.Run(fmt.Sprintf("rate_limit_at_%v", currentTest.rateLimit), func(t *testing.T) {
|
test.Run(fmt.Sprintf("rate_limit_at_%v", currentTest.rateLimit), func(t *testing.T) {
|
||||||
tt := currentTest
|
tt := currentTest
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
a := NewTestAgent(t, "cache = { entry_fetch_rate = 1, entry_fetch_max_burst = 1 }")
|
a := NewTestAgent(t, "cache = { entry_fetch_rate = 1, entry_fetch_max_burst = 100 }")
|
||||||
defer a.Shutdown()
|
defer a.Shutdown()
|
||||||
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
testrpc.WaitForTestAgent(t, a.RPC, "dc1")
|
||||||
|
|
||||||
cfg := a.config
|
cfg := a.config
|
||||||
require.Equal(t, rate.Limit(1), a.config.Cache.EntryFetchRate)
|
require.Equal(t, rate.Limit(1), a.config.Cache.EntryFetchRate)
|
||||||
|
require.Equal(t, 100, a.config.Cache.EntryFetchMaxBurst)
|
||||||
cfg.Cache.EntryFetchRate = rate.Limit(tt.rateLimit)
|
cfg.Cache.EntryFetchRate = rate.Limit(tt.rateLimit)
|
||||||
|
cfg.Cache.EntryFetchMaxBurst = 1
|
||||||
a.reloadConfigInternal(cfg)
|
a.reloadConfigInternal(cfg)
|
||||||
require.Equal(t, rate.Limit(tt.rateLimit), a.config.Cache.EntryFetchRate)
|
require.Equal(t, rate.Limit(tt.rateLimit), a.config.Cache.EntryFetchRate)
|
||||||
|
require.Equal(t, 1, a.config.Cache.EntryFetchMaxBurst)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
stillProcessing := true
|
stillProcessing := true
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue