From 255492bb2d80bfaeaa68a7c93aae37c47f1f79d8 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Sun, 8 Apr 2018 03:57:01 -0700 Subject: [PATCH] add unit tests: limits configuration should be reloadable --- agent/agent_endpoint_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index 940304b548..f4a800b81d 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -281,6 +281,10 @@ func TestAgent_Reload(t *testing.T) { handler = "true" } ] + limits = { + rpc_rate=1 + rpc_max_burst=100 + } `) defer a.Shutdown() @@ -302,6 +306,10 @@ func TestAgent_Reload(t *testing.T) { name = "redis-reloaded" } ] + limits = { + rpc_rate=2 + rpc_max_burst=200 + } `, }) @@ -312,6 +320,14 @@ func TestAgent_Reload(t *testing.T) { t.Fatal("missing redis-reloaded service") } + if a.config.RPCRateLimit != 2 { + t.Fatalf("RPC rate not set correctly. Got %v. Want 2", a.config.RPCRateLimit) + } + + if a.config.RPCMaxBurst != 200 { + t.Fatalf("RPC max burst not set correctly. Got %v. Want 200", a.config.RPCMaxBurst) + } + for _, wp := range a.watchPlans { if !wp.IsStopped() { t.Fatalf("Reloading configs should stop watch plans of the previous configuration")