From 13c3547764dfd681ed2379c3adafd7d64c61d4fa Mon Sep 17 00:00:00 2001 From: Shawn Poulson Date: Thu, 22 Feb 2024 12:04:12 -0500 Subject: [PATCH] Allow test to pass when run with `-count n`; n > 1. --- functional_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functional_test.go b/functional_test.go index e3c3e551..43254eea 100644 --- a/functional_test.go +++ b/functional_test.go @@ -21,6 +21,7 @@ import ( "context" "fmt" "io" + "math/rand" "net/http" "os" "strings" @@ -1025,6 +1026,7 @@ func TestGlobalRateLimitsWithLoadBalancing(t *testing.T) { owner := cluster.PeerAt(2).GRPCAddress peer := cluster.PeerAt(0).GRPCAddress assert.NotEqual(t, owner, peer) + key := fmt.Sprintf("key:%04x", rand.Intn(1<<16)) dialOpts := []grpc.DialOption{ grpc.WithResolvers(newStaticBuilder()), @@ -1045,7 +1047,7 @@ func TestGlobalRateLimitsWithLoadBalancing(t *testing.T) { Requests: []*guber.RateLimitReq{ { Name: "test_global", - UniqueKey: "account:12345", + UniqueKey: key, Algorithm: guber.Algorithm_LEAKY_BUCKET, Behavior: guber.Behavior_GLOBAL, Duration: guber.Minute * 5,