diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-14 16:02:48 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-15 10:17:04 +0300 |
commit | 2766b879b037ad07e4313e76debbede691b40000 (patch) | |
tree | 508851385e3291219929d4986a89184794d37b48 /internal | |
parent | be7617b20bbeb81c1036443c6b176574cc3d3b8f (diff) |
limithandler: Run tests in parallel
Run tests in parallel, which is an easy thing to do now that the
limithandler package doesn't rely on global state anymore.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/middleware/limithandler/concurrency_limiter_test.go | 5 | ||||
-rw-r--r-- | internal/middleware/limithandler/middleware_test.go | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/internal/middleware/limithandler/concurrency_limiter_test.go b/internal/middleware/limithandler/concurrency_limiter_test.go index bff19c688..638e22b89 100644 --- a/internal/middleware/limithandler/concurrency_limiter_test.go +++ b/internal/middleware/limithandler/concurrency_limiter_test.go @@ -70,6 +70,8 @@ func (c *counter) Exit(ctx context.Context) { } func TestLimiter(t *testing.T) { + t.Parallel() + tests := []struct { name string concurrency int @@ -123,7 +125,10 @@ func TestLimiter(t *testing.T) { }, } for _, tt := range tests { + tt := tt t.Run(tt.name, func(t *testing.T) { + t.Parallel() + ctx, cancel := testhelper.Context() defer cancel() diff --git a/internal/middleware/limithandler/middleware_test.go b/internal/middleware/limithandler/middleware_test.go index 7f3c3149b..16926c004 100644 --- a/internal/middleware/limithandler/middleware_test.go +++ b/internal/middleware/limithandler/middleware_test.go @@ -25,6 +25,8 @@ func fixedLockKey(ctx context.Context) string { } func TestUnaryLimitHandler(t *testing.T) { + t.Parallel() + s := &server{blockCh: make(chan struct{})} cfg := config.Cfg{ @@ -70,6 +72,8 @@ func TestUnaryLimitHandler(t *testing.T) { } func TestStreamLimitHandler(t *testing.T) { + t.Parallel() + testCases := []struct { desc string fullname string @@ -176,6 +180,8 @@ func TestStreamLimitHandler(t *testing.T) { for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { + t.Parallel() + s := &server{blockCh: make(chan struct{})} cfg := config.Cfg{ |