diff --git a/allowed_ips_test.go b/allowed_ips_test.go index da4f49b..2eb78de 100644 --- a/allowed_ips_test.go +++ b/allowed_ips_test.go @@ -30,6 +30,7 @@ import ( ) func TestAllowedIps(t *testing.T) { + t.Parallel() require := require.New(t) a, err := ParseAllowedIps("127.0.0.1, 192.168.0.1, 192.168.1.1/24") require.NoError(err) @@ -49,6 +50,7 @@ func TestAllowedIps(t *testing.T) { for _, addr := range allowed { t.Run(addr, func(t *testing.T) { + t.Parallel() assert := assert.New(t) if ip := net.ParseIP(addr); assert.NotNil(ip, "error parsing %s", addr) { assert.True(a.Allowed(ip), "should allow %s", addr) @@ -58,6 +60,7 @@ func TestAllowedIps(t *testing.T) { for _, addr := range notAllowed { t.Run(addr, func(t *testing.T) { + t.Parallel() assert := assert.New(t) if ip := net.ParseIP(addr); assert.NotNil(ip, "error parsing %s", addr) { assert.False(a.Allowed(ip), "should not allow %s", addr) diff --git a/api/stringmap_test.go b/api/stringmap_test.go index 941c7f9..f54e3db 100644 --- a/api/stringmap_test.go +++ b/api/stringmap_test.go @@ -28,6 +28,7 @@ import ( ) func TestConvertStringMap(t *testing.T) { + t.Parallel() assert := assert.New(t) d := map[string]any{ "foo": "bar", @@ -56,6 +57,7 @@ func TestConvertStringMap(t *testing.T) { } func TestGetStringMapString(t *testing.T) { + t.Parallel() assert := assert.New(t) type StringMapTestString string @@ -90,6 +92,7 @@ func TestGetStringMapString(t *testing.T) { } func TestGetStringMapStringMap(t *testing.T) { + t.Parallel() assert := assert.New(t) m := StringMap{ diff --git a/backend_configuration_test.go b/backend_configuration_test.go index e22d160..12e9fd1 100644 --- a/backend_configuration_test.go +++ b/backend_configuration_test.go @@ -37,6 +37,7 @@ import ( func testUrls(t *testing.T, config *BackendConfiguration, valid_urls []string, invalid_urls []string) { for _, u := range valid_urls { t.Run(u, func(t *testing.T) { + t.Parallel() assert := assert.New(t) parsed, err := url.ParseRequestURI(u) if !assert.NoError(err, "The url %s should be valid", u) { @@ -49,6 +50,7 @@ func testUrls(t *testing.T, config *BackendConfiguration, valid_urls []string, i } for _, u := range invalid_urls { t.Run(u, func(t *testing.T) { + t.Parallel() assert := assert.New(t) parsed, _ := url.ParseRequestURI(u) assert.False(config.IsUrlAllowed(parsed), "The url %s should not be allowed", u) @@ -59,6 +61,7 @@ func testUrls(t *testing.T, config *BackendConfiguration, valid_urls []string, i func testBackends(t *testing.T, config *BackendConfiguration, valid_urls [][]string, invalid_urls []string) { for _, entry := range valid_urls { t.Run(entry[0], func(t *testing.T) { + t.Parallel() assert := assert.New(t) u := entry[0] parsed, err := url.ParseRequestURI(u) @@ -73,6 +76,7 @@ func testBackends(t *testing.T, config *BackendConfiguration, valid_urls [][]str } for _, u := range invalid_urls { t.Run(u, func(t *testing.T) { + t.Parallel() assert := assert.New(t) parsed, _ := url.ParseRequestURI(u) assert.False(config.IsUrlAllowed(parsed), "The url %s should not be allowed", u) @@ -81,6 +85,7 @@ func testBackends(t *testing.T, config *BackendConfiguration, valid_urls [][]str } func TestIsUrlAllowed_Compat(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) // Old-style configuration valid_urls := []string{ @@ -102,6 +107,7 @@ func TestIsUrlAllowed_Compat(t *testing.T) { } func TestIsUrlAllowed_CompatForceHttps(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) // Old-style configuration, force HTTPS valid_urls := []string{ @@ -122,6 +128,7 @@ func TestIsUrlAllowed_CompatForceHttps(t *testing.T) { } func TestIsUrlAllowed(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) valid_urls := [][]string{ {"https://domain.invalid/foo", string(testBackendSecret) + "-foo"}, @@ -166,6 +173,7 @@ func TestIsUrlAllowed(t *testing.T) { } func TestIsUrlAllowed_EmptyAllowlist(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) valid_urls := []string{} invalid_urls := []string{ @@ -182,6 +190,7 @@ func TestIsUrlAllowed_EmptyAllowlist(t *testing.T) { } func TestIsUrlAllowed_AllowAll(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) valid_urls := []string{ "http://domain.invalid", @@ -206,6 +215,7 @@ type ParseBackendIdsTestcase struct { } func TestParseBackendIds(t *testing.T) { + t.Parallel() testcases := []ParseBackendIdsTestcase{ {"", nil}, {"backend1", []string{"backend1"}}, @@ -223,7 +233,7 @@ func TestParseBackendIds(t *testing.T) { } } -func TestBackendReloadNoChange(t *testing.T) { +func TestBackendReloadNoChange(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -257,7 +267,7 @@ func TestBackendReloadNoChange(t *testing.T) { } } -func TestBackendReloadChangeExistingURL(t *testing.T) { +func TestBackendReloadChangeExistingURL(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -296,7 +306,7 @@ func TestBackendReloadChangeExistingURL(t *testing.T) { } } -func TestBackendReloadChangeSecret(t *testing.T) { +func TestBackendReloadChangeSecret(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -331,7 +341,7 @@ func TestBackendReloadChangeSecret(t *testing.T) { assert.Equal(t, n_cfg, o_cfg, "BackendConfiguration should be equal after Reload") } -func TestBackendReloadAddBackend(t *testing.T) { +func TestBackendReloadAddBackend(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -370,7 +380,7 @@ func TestBackendReloadAddBackend(t *testing.T) { } } -func TestBackendReloadRemoveHost(t *testing.T) { +func TestBackendReloadRemoveHost(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -406,7 +416,7 @@ func TestBackendReloadRemoveHost(t *testing.T) { } } -func TestBackendReloadRemoveBackendFromSharedHost(t *testing.T) { +func TestBackendReloadRemoveBackendFromSharedHost(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -458,7 +468,7 @@ func mustParse(s string) *url.URL { return p } -func TestBackendConfiguration_EtcdCompat(t *testing.T) { +func TestBackendConfiguration_EtcdCompat(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -619,7 +629,7 @@ func TestBackendCommonSecret(t *testing.T) { } } -func TestBackendChangeUrls(t *testing.T) { +func TestBackendChangeUrls(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) @@ -710,7 +720,7 @@ func TestBackendChangeUrls(t *testing.T) { assert.Nil(b1) } -func TestBackendConfiguration_EtcdChangeUrls(t *testing.T) { +func TestBackendConfiguration_EtcdChangeUrls(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsBackendsCurrent) logger := NewLoggerForTest(t) diff --git a/backend_server_test.go b/backend_server_test.go index 7a89a82..f6f3416 100644 --- a/backend_server_test.go +++ b/backend_server_test.go @@ -390,6 +390,7 @@ func TestBackendServer_UnsupportedRequest(t *testing.T) { } func TestBackendServer_RoomInvite(t *testing.T) { + t.Parallel() for _, backend := range eventBackendsForTest { t.Run(backend, func(t *testing.T) { t.Parallel() @@ -457,6 +458,7 @@ func RunTestBackendServer_RoomInvite(ctx context.Context, t *testing.T) { } func TestBackendServer_RoomDisinvite(t *testing.T) { + t.Parallel() for _, backend := range eventBackendsForTest { t.Run(backend, func(t *testing.T) { t.Parallel() @@ -615,6 +617,7 @@ func TestBackendServer_RoomDisinviteDifferentRooms(t *testing.T) { } func TestBackendServer_RoomUpdate(t *testing.T) { + t.Parallel() for _, backend := range eventBackendsForTest { t.Run(backend, func(t *testing.T) { t.Parallel() @@ -684,6 +687,7 @@ func RunTestBackendServer_RoomUpdate(ctx context.Context, t *testing.T) { } func TestBackendServer_RoomDelete(t *testing.T) { + t.Parallel() for _, backend := range eventBackendsForTest { t.Run(backend, func(t *testing.T) { t.Parallel() @@ -750,6 +754,7 @@ func RunTestBackendServer_RoomDelete(ctx context.Context, t *testing.T) { } func TestBackendServer_ParticipantsUpdatePermissions(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -1069,6 +1074,7 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) { } func TestBackendServer_InCallAll(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -1315,6 +1321,7 @@ func TestBackendServer_TurnCredentials(t *testing.T) { } func TestBackendServer_StatsAllowedIps(t *testing.T) { + t.Parallel() config := goconf.NewConfigFile() config.AddOption("app", "trustedproxies", "1.2.3.4") config.AddOption("stats", "allowed_ips", "127.0.0.1, 192.168.0.1, 192.168.1.1/24") diff --git a/backend_storage_etcd_test.go b/backend_storage_etcd_test.go index 2c62520..5b4a21b 100644 --- a/backend_storage_etcd_test.go +++ b/backend_storage_etcd_test.go @@ -52,7 +52,7 @@ func (tl *testListener) EtcdClientCreated(client *EtcdClient) { close(tl.closed) } -func Test_BackendStorageEtcdNoLeak(t *testing.T) { +func Test_BackendStorageEtcdNoLeak(t *testing.T) { // nolint:paralleltest logger := NewLoggerForTest(t) ensureNoGoroutinesLeak(t, func(t *testing.T) { etcd, client := NewEtcdClientForTest(t) diff --git a/backoff_test.go b/backoff_test.go index 9882238..3ba3504 100644 --- a/backoff_test.go +++ b/backoff_test.go @@ -31,6 +31,7 @@ import ( ) func TestBackoff_Exponential(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) minWait := 100 * time.Millisecond diff --git a/channel_waiter_test.go b/channel_waiter_test.go index 9141642..cb6c961 100644 --- a/channel_waiter_test.go +++ b/channel_waiter_test.go @@ -28,6 +28,7 @@ import ( ) func TestChannelWaiters(t *testing.T) { + t.Parallel() var waiters ChannelWaiters ch1 := make(chan struct{}, 1) diff --git a/client/stats_test.go b/client/stats_test.go index 9ef132a..0bbafe6 100644 --- a/client/stats_test.go +++ b/client/stats_test.go @@ -30,6 +30,7 @@ import ( ) func TestStats(t *testing.T) { + t.Parallel() assert := assert.New(t) var stats Stats diff --git a/client_test.go b/client_test.go index 8afce5d..d5ee6fc 100644 --- a/client_test.go +++ b/client_test.go @@ -29,6 +29,7 @@ import ( ) func TestCounterWriter(t *testing.T) { + t.Parallel() assert := assert.New(t) var b bytes.Buffer diff --git a/clientsession_test.go b/clientsession_test.go index b0f0cb4..b5e1f82 100644 --- a/clientsession_test.go +++ b/clientsession_test.go @@ -84,24 +84,6 @@ func TestBandwidth_Client(t *testing.T) { func TestBandwidth_Backend(t *testing.T) { t.Parallel() - hub, _, _, server := CreateHubWithMultipleBackendsForTest(t) - - u, err := url.Parse(server.URL + "/one") - require.NoError(t, err) - backend := hub.backend.GetBackend(u) - require.NotNil(t, backend, "Could not get backend") - - backend.maxScreenBitrate = 1000 - backend.maxStreamBitrate = 2000 - - ctx, cancel := context.WithTimeout(context.Background(), testTimeout) - defer cancel() - - mcu := NewTestMCU(t) - require.NoError(t, mcu.Start(ctx)) - defer mcu.Stop() - - hub.SetMcu(mcu) streamTypes := []StreamType{ StreamTypeVideo, @@ -110,8 +92,29 @@ func TestBandwidth_Backend(t *testing.T) { for _, streamType := range streamTypes { t.Run(string(streamType), func(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) + + hub, _, _, server := CreateHubWithMultipleBackendsForTest(t) + + u, err := url.Parse(server.URL + "/one") + require.NoError(err) + backend := hub.backend.GetBackend(u) + require.NotNil(t, backend, "Could not get backend") + + backend.maxScreenBitrate = 1000 + backend.maxStreamBitrate = 2000 + + ctx, cancel := context.WithTimeout(context.Background(), testTimeout) + defer cancel() + + mcu := NewTestMCU(t) + require.NoError(mcu.Start(ctx)) + defer mcu.Stop() + + hub.SetMcu(mcu) + client := NewTestClient(t, server, hub) defer client.CloseWithBye() @@ -243,13 +246,16 @@ func TestFeatureChatRelay(t *testing.T) { } } - t.Run("without-chat-relay", testFunc(false)) - t.Run("with-chat-relay", testFunc(true)) + t.Run("without-chat-relay", testFunc(false)) // nolint:paralleltest + t.Run("with-chat-relay", testFunc(true)) // nolint:paralleltest } func TestFeatureChatRelayFederation(t *testing.T) { + t.Parallel() + var testFunc = func(feature bool) func(t *testing.T) { return func(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) @@ -452,8 +458,8 @@ func TestFeatureChatRelayFederation(t *testing.T) { } } - t.Run("without-chat-relay", testFunc(false)) - t.Run("with-chat-relay", testFunc(true)) + t.Run("without-chat-relay", testFunc(false)) // nolint:paralleltest + t.Run("with-chat-relay", testFunc(true)) // nolint:paralleltest } func TestPermissionHideDisplayNames(t *testing.T) { @@ -566,6 +572,6 @@ func TestPermissionHideDisplayNames(t *testing.T) { } } - t.Run("without-hide-displaynames", testFunc(false)) - t.Run("with-hide-displaynames", testFunc(true)) + t.Run("without-hide-displaynames", testFunc(false)) // nolint:paralleltest + t.Run("with-hide-displaynames", testFunc(true)) // nolint:paralleltest } diff --git a/closer_test.go b/closer_test.go index f51f3f3..472c210 100644 --- a/closer_test.go +++ b/closer_test.go @@ -29,6 +29,7 @@ import ( ) func TestCloserMulti(t *testing.T) { + t.Parallel() closer := NewCloser() var wg sync.WaitGroup @@ -48,6 +49,7 @@ func TestCloserMulti(t *testing.T) { } func TestCloserCloseBeforeWait(t *testing.T) { + t.Parallel() closer := NewCloser() closer.Close() assert.True(t, closer.IsClosed()) diff --git a/concurrentmap_test.go b/concurrentmap_test.go index c52ae7e..ad20098 100644 --- a/concurrentmap_test.go +++ b/concurrentmap_test.go @@ -30,6 +30,7 @@ import ( ) func TestConcurrentStringStringMap(t *testing.T) { + t.Parallel() assert := assert.New(t) var m ConcurrentMap[string, string] assert.Equal(0, m.Len()) diff --git a/deferred_executor_test.go b/deferred_executor_test.go index 183b2ae..4ff6a60 100644 --- a/deferred_executor_test.go +++ b/deferred_executor_test.go @@ -29,6 +29,7 @@ import ( ) func TestDeferredExecutor_MultiClose(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 0) defer e.waitForStop() @@ -38,6 +39,7 @@ func TestDeferredExecutor_MultiClose(t *testing.T) { } func TestDeferredExecutor_QueueSize(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 0) @@ -61,6 +63,7 @@ func TestDeferredExecutor_QueueSize(t *testing.T) { } func TestDeferredExecutor_Order(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 64) defer e.waitForStop() @@ -89,6 +92,7 @@ func TestDeferredExecutor_Order(t *testing.T) { } func TestDeferredExecutor_CloseFromFunc(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 64) defer e.waitForStop() @@ -103,6 +107,7 @@ func TestDeferredExecutor_CloseFromFunc(t *testing.T) { } func TestDeferredExecutor_DeferAfterClose(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 64) defer e.waitForStop() @@ -115,6 +120,7 @@ func TestDeferredExecutor_DeferAfterClose(t *testing.T) { } func TestDeferredExecutor_WaitForStopTwice(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) e := NewDeferredExecutor(logger, 64) defer e.waitForStop() diff --git a/dns_monitor_test.go b/dns_monitor_test.go index 7d43dd7..77b2379 100644 --- a/dns_monitor_test.go +++ b/dns_monitor_test.go @@ -223,7 +223,7 @@ func (r *dnsMonitorReceiver) ExpectNone() { r.expected = expectNone } -func TestDnsMonitor(t *testing.T) { +func TestDnsMonitor(t *testing.T) { // nolint:paralleltest lookup := newMockDnsLookupForTest(t) ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() @@ -292,6 +292,7 @@ func TestDnsMonitor(t *testing.T) { } func TestDnsMonitorIP(t *testing.T) { + t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() @@ -316,7 +317,7 @@ func TestDnsMonitorIP(t *testing.T) { time.Sleep(5 * interval) } -func TestDnsMonitorNoLookupIfEmpty(t *testing.T) { +func TestDnsMonitorNoLookupIfEmpty(t *testing.T) { // nolint:paralleltest interval := time.Millisecond monitor := newDnsMonitorForTest(t, interval) @@ -401,7 +402,7 @@ func (r *deadlockMonitorReceiver) Close() { r.wg.Wait() } -func TestDnsMonitorDeadlock(t *testing.T) { +func TestDnsMonitorDeadlock(t *testing.T) { // nolint:paralleltest lookup := newMockDnsLookupForTest(t) ip1 := net.ParseIP("192.168.0.1") ip2 := net.ParseIP("192.168.0.2") diff --git a/federation_test.go b/federation_test.go index 92eabf0..0d6ab77 100644 --- a/federation_test.go +++ b/federation_test.go @@ -36,6 +36,7 @@ import ( ) func Test_FederationInvalidToken(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -73,6 +74,7 @@ func Test_FederationInvalidToken(t *testing.T) { } func Test_Federation(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -488,6 +490,7 @@ func Test_Federation(t *testing.T) { } func Test_FederationJoinRoomTwice(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -593,6 +596,7 @@ func Test_FederationJoinRoomTwice(t *testing.T) { } func Test_FederationChangeRoom(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -700,6 +704,7 @@ func Test_FederationChangeRoom(t *testing.T) { } func Test_FederationMedia(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -803,6 +808,7 @@ func Test_FederationMedia(t *testing.T) { } func Test_FederationResume(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -922,6 +928,7 @@ func Test_FederationResume(t *testing.T) { } func Test_FederationResumeNewSession(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -1044,6 +1051,7 @@ func Test_FederationResumeNewSession(t *testing.T) { } func Test_FederationTransientData(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) diff --git a/file_watcher_test.go b/file_watcher_test.go index 5a29a73..f437193 100644 --- a/file_watcher_test.go +++ b/file_watcher_test.go @@ -36,6 +36,7 @@ var ( ) func TestFileWatcher_NotExist(t *testing.T) { + t.Parallel() assert := assert.New(t) tmpdir := t.TempDir() logger := NewLoggerForTest(t) @@ -46,7 +47,7 @@ func TestFileWatcher_NotExist(t *testing.T) { } } -func TestFileWatcher_File(t *testing.T) { +func TestFileWatcher_File(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { require := require.New(t) assert := assert.New(t) @@ -88,7 +89,7 @@ func TestFileWatcher_File(t *testing.T) { }) } -func TestFileWatcher_CurrentDir(t *testing.T) { +func TestFileWatcher_CurrentDir(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { require := require.New(t) assert := assert.New(t) @@ -132,6 +133,7 @@ func TestFileWatcher_CurrentDir(t *testing.T) { } func TestFileWatcher_Rename(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) tmpdir := t.TempDir() @@ -172,6 +174,7 @@ func TestFileWatcher_Rename(t *testing.T) { } func TestFileWatcher_Symlink(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) tmpdir := t.TempDir() @@ -203,6 +206,7 @@ func TestFileWatcher_Symlink(t *testing.T) { } func TestFileWatcher_ChangeSymlinkTarget(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) tmpdir := t.TempDir() @@ -239,6 +243,7 @@ func TestFileWatcher_ChangeSymlinkTarget(t *testing.T) { } func TestFileWatcher_OtherSymlink(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) tmpdir := t.TempDir() @@ -272,6 +277,7 @@ func TestFileWatcher_OtherSymlink(t *testing.T) { } func TestFileWatcher_RenameSymlinkTarget(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) tmpdir := t.TempDir() @@ -315,6 +321,7 @@ func TestFileWatcher_RenameSymlinkTarget(t *testing.T) { } func TestFileWatcher_UpdateSymlinkFolder(t *testing.T) { + t.Parallel() // This mimics what k8s is doing with configmaps / secrets. require := require.New(t) assert := assert.New(t) diff --git a/flags_test.go b/flags_test.go index 4bc5d6d..de162de 100644 --- a/flags_test.go +++ b/flags_test.go @@ -30,6 +30,7 @@ import ( ) func TestFlags(t *testing.T) { + t.Parallel() assert := assert.New(t) var f Flags assert.EqualValues(0, f.Get()) diff --git a/geoip_test.go b/geoip_test.go index fecbc5a..3a03ed1 100644 --- a/geoip_test.go +++ b/geoip_test.go @@ -76,6 +76,7 @@ func GetGeoIpUrlForTest(t *testing.T) string { } func TestGeoLookup(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) require := require.New(t) reader, err := NewGeoLookupFromUrl(logger, GetGeoIpUrlForTest(t)) @@ -88,6 +89,7 @@ func TestGeoLookup(t *testing.T) { } func TestGeoLookupCaching(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) require := require.New(t) reader, err := NewGeoLookupFromUrl(logger, GetGeoIpUrlForTest(t)) @@ -102,6 +104,7 @@ func TestGeoLookupCaching(t *testing.T) { } func TestGeoLookupContinent(t *testing.T) { + t.Parallel() tests := map[string][]string{ "AU": {"OC"}, "DE": {"EU"}, @@ -112,6 +115,7 @@ func TestGeoLookupContinent(t *testing.T) { for country, expected := range tests { t.Run(country, func(t *testing.T) { + t.Parallel() continents := LookupContinents(country) if !assert.Equal(t, len(expected), len(continents), "Continents didn't match for %s: got %s, expected %s", country, continents, expected) { return @@ -126,6 +130,7 @@ func TestGeoLookupContinent(t *testing.T) { } func TestGeoLookupCloseEmpty(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) reader, err := NewGeoLookupFromUrl(logger, "ignore-url") require.NoError(t, err) @@ -133,6 +138,7 @@ func TestGeoLookupCloseEmpty(t *testing.T) { } func TestGeoLookupFromFile(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) require := require.New(t) geoIpUrl := GetGeoIpUrlForTest(t) @@ -196,6 +202,7 @@ func TestGeoLookupFromFile(t *testing.T) { } func TestIsValidContinent(t *testing.T) { + t.Parallel() for country, continents := range ContinentMap { for _, continent := range continents { assert.True(t, IsValidContinent(continent), "Continent %s of country %s is not valid", continent, country) diff --git a/grpc_client_test.go b/grpc_client_test.go index 031c1ba..825d982 100644 --- a/grpc_client_test.go +++ b/grpc_client_test.go @@ -110,7 +110,7 @@ func waitForEvent(ctx context.Context, t *testing.T, ch <-chan struct{}) { } } -func Test_GrpcClients_EtcdInitial(t *testing.T) { +func Test_GrpcClients_EtcdInitial(t *testing.T) { // nolint:paralleltest logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) ensureNoGoroutinesLeak(t, func(t *testing.T) { @@ -219,7 +219,7 @@ func Test_GrpcClients_EtcdIgnoreSelf(t *testing.T) { } } -func Test_GrpcClients_DnsDiscovery(t *testing.T) { +func Test_GrpcClients_DnsDiscovery(t *testing.T) { // nolint:paralleltest logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) ensureNoGoroutinesLeak(t, func(t *testing.T) { @@ -274,7 +274,7 @@ func Test_GrpcClients_DnsDiscovery(t *testing.T) { }) } -func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) { +func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) { // nolint:paralleltest assert := assert.New(t) lookup := newMockDnsLookupForTest(t) target := "testgrpc:12345" @@ -303,7 +303,7 @@ func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) { } } -func Test_GrpcClients_Encryption(t *testing.T) { +func Test_GrpcClients_Encryption(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { require := require.New(t) serverKey, err := rsa.GenerateKey(rand.Reader, 1024) diff --git a/grpc_server_test.go b/grpc_server_test.go index 87a036a..c476ac1 100644 --- a/grpc_server_test.go +++ b/grpc_server_test.go @@ -97,7 +97,7 @@ func NewGrpcServerForTest(t *testing.T) (server *GrpcServer, addr string) { return NewGrpcServerForTestWithConfig(t, config) } -func Test_GrpcServer_ReloadCerts(t *testing.T) { +func Test_GrpcServer_ReloadCerts(t *testing.T) { // nolint:paralleltest require := require.New(t) assert := assert.New(t) key, err := rsa.GenerateKey(rand.Reader, 1024) @@ -167,7 +167,7 @@ func Test_GrpcServer_ReloadCerts(t *testing.T) { } } -func Test_GrpcServer_ReloadCA(t *testing.T) { +func Test_GrpcServer_ReloadCA(t *testing.T) { // nolint:paralleltest logger := NewLoggerForTest(t) require := require.New(t) serverKey, err := rsa.GenerateKey(rand.Reader, 1024) diff --git a/hub_test.go b/hub_test.go index 657508e..be410d8 100644 --- a/hub_test.go +++ b/hub_test.go @@ -1000,8 +1000,10 @@ func TestClientHelloV1(t *testing.T) { } func TestClientHelloV2(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1036,8 +1038,10 @@ func TestClientHelloV2(t *testing.T) { } func TestClientHelloV2_IssuedInFuture(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1061,8 +1065,10 @@ func TestClientHelloV2_IssuedInFuture(t *testing.T) { } func TestClientHelloV2_IssuedFarInFuture(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1082,8 +1088,10 @@ func TestClientHelloV2_IssuedFarInFuture(t *testing.T) { } func TestClientHelloV2_Expired(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1103,8 +1111,10 @@ func TestClientHelloV2_Expired(t *testing.T) { } func TestClientHelloV2_IssuedAtMissing(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1124,8 +1134,10 @@ func TestClientHelloV2_IssuedAtMissing(t *testing.T) { } func TestClientHelloV2_ExpiresAtMissing(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1145,8 +1157,10 @@ func TestClientHelloV2_ExpiresAtMissing(t *testing.T) { } func TestClientHelloV2_CachedCapabilities(t *testing.T) { + t.Parallel() for _, algo := range testHelloV2Algorithms { t.Run(algo, func(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) hub, _, _, server := CreateHubForTest(t) @@ -1219,6 +1233,7 @@ func TestClientHelloAllowAll(t *testing.T) { } func TestClientHelloSessionLimit(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -1752,7 +1767,7 @@ func runGrpcProxyTest(t *testing.T, f func(hub1, hub2 *Hub, server1, server2 *ht f(hub1, hub2, server1, server2) } -func TestClientHelloResumeProxy(t *testing.T) { +func TestClientHelloResumeProxy(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) { require := require.New(t) @@ -1802,7 +1817,7 @@ func TestClientHelloResumeProxy(t *testing.T) { }) } -func TestClientHelloResumeProxy_Takeover(t *testing.T) { +func TestClientHelloResumeProxy_Takeover(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) { require := require.New(t) @@ -1856,7 +1871,7 @@ func TestClientHelloResumeProxy_Takeover(t *testing.T) { }) } -func TestClientHelloResumeProxy_Disconnect(t *testing.T) { +func TestClientHelloResumeProxy_Disconnect(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) { require := require.New(t) @@ -1951,6 +1966,7 @@ func TestClientHelloInternal(t *testing.T) { } func TestClientMessageToSessionId(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -2015,6 +2031,7 @@ func TestClientMessageToSessionId(t *testing.T) { } func TestClientControlToSessionId(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -2237,6 +2254,7 @@ func TestClientMessageToUserIdMultipleSessions(t *testing.T) { } func TestClientMessageToRoom(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -2299,6 +2317,7 @@ func TestClientMessageToRoom(t *testing.T) { } func TestClientControlToRoom(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -2361,6 +2380,7 @@ func TestClientControlToRoom(t *testing.T) { } func TestClientMessageToCall(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -2465,6 +2485,7 @@ func TestClientMessageToCall(t *testing.T) { } func TestClientControlToCall(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -3049,6 +3070,7 @@ func TestJoinRoomSwitchClient(t *testing.T) { } func TestGetRealUserIP(t *testing.T) { + t.Parallel() testcases := []struct { expected string headers http.Header @@ -3473,6 +3495,7 @@ func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) { } func TestClientTakeoverRoomSession(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -3902,6 +3925,7 @@ loop: } func TestClientRequestOfferNotInRoom(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -4300,6 +4324,7 @@ func TestSameRoomOnDifferentUrls(t *testing.T) { } func TestClientSendOffer(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -4442,6 +4467,7 @@ func TestClientUnshareScreen(t *testing.T) { } func TestVirtualClientSessions(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -4682,6 +4708,7 @@ func TestVirtualClientSessions(t *testing.T) { } func TestDuplicateVirtualSessions(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -5041,12 +5068,14 @@ func DoTestSwitchToOne(t *testing.T, details api.StringMap) { } func TestSwitchToOneMap(t *testing.T) { + t.Parallel() DoTestSwitchToOne(t, api.StringMap{ "foo": "bar", }) } func TestSwitchToOneList(t *testing.T) { + t.Parallel() DoTestSwitchToOne(t, nil) } @@ -5139,6 +5168,7 @@ func DoTestSwitchToMultiple(t *testing.T, details1 api.StringMap, details2 api.S } func TestSwitchToMultipleMap(t *testing.T) { + t.Parallel() DoTestSwitchToMultiple(t, api.StringMap{ "foo": "bar", }, api.StringMap{ @@ -5147,10 +5177,12 @@ func TestSwitchToMultipleMap(t *testing.T) { } func TestSwitchToMultipleList(t *testing.T) { + t.Parallel() DoTestSwitchToMultiple(t, nil, nil) } func TestSwitchToMultipleMixed(t *testing.T) { + t.Parallel() DoTestSwitchToMultiple(t, api.StringMap{ "foo": "bar", }, nil) diff --git a/internal/canonicalize_url_test.go b/internal/canonicalize_url_test.go index 0cb3a5e..9c9b1a1 100644 --- a/internal/canonicalize_url_test.go +++ b/internal/canonicalize_url_test.go @@ -30,6 +30,7 @@ import ( ) func TestCanonicalizeUrl(t *testing.T) { + t.Parallel() mustParse := func(s string) *url.URL { t.Helper() u, err := url.Parse(s) @@ -79,6 +80,7 @@ func TestCanonicalizeUrl(t *testing.T) { } func TestCanonicalizeUrlString(t *testing.T) { + t.Parallel() testcases := []struct { s string expected string diff --git a/internal/ips_test.go b/internal/ips_test.go index 94516ea..804e58f 100644 --- a/internal/ips_test.go +++ b/internal/ips_test.go @@ -28,6 +28,7 @@ import ( ) func TestIsLoopbackIP(t *testing.T) { + t.Parallel() loopback := []string{ "127.0.0.1", "127.1.0.1", @@ -51,6 +52,7 @@ func TestIsLoopbackIP(t *testing.T) { } func TestIsPrivateIP(t *testing.T) { + t.Parallel() private := []string{ "10.1.2.3", "172.20.21.22", diff --git a/lru_test.go b/lru_test.go index 572b5d5..52c672b 100644 --- a/lru_test.go +++ b/lru_test.go @@ -29,6 +29,7 @@ import ( ) func TestLruUnbound(t *testing.T) { + t.Parallel() assert := assert.New(t) lru := NewLruCache[int](0) count := 10 @@ -95,6 +96,7 @@ func TestLruUnbound(t *testing.T) { } func TestLruBound(t *testing.T) { + t.Parallel() assert := assert.New(t) size := 2 lru := NewLruCache[int](size) diff --git a/mcu_common_test.go b/mcu_common_test.go index 7632f92..0e4e839 100644 --- a/mcu_common_test.go +++ b/mcu_common_test.go @@ -28,6 +28,7 @@ import ( ) func TestCommonMcuStats(t *testing.T) { + t.Parallel() collectAndLint(t, commonMcuStats...) } diff --git a/mcu_janus_events_handler_test.go b/mcu_janus_events_handler_test.go index 55aed9c..1063023 100644 --- a/mcu_janus_events_handler_test.go +++ b/mcu_janus_events_handler_test.go @@ -498,6 +498,7 @@ func TestJanusEventsHandlerDifferentTypes(t *testing.T) { } func TestJanusEventsHandlerNotGrouped(t *testing.T) { + t.Parallel() require := require.New(t) assert := assert.New(t) diff --git a/mcu_janus_publisher_test.go b/mcu_janus_publisher_test.go index 31d3acf..3e409e6 100644 --- a/mcu_janus_publisher_test.go +++ b/mcu_janus_publisher_test.go @@ -34,6 +34,7 @@ import ( ) func TestGetFmtpValueH264(t *testing.T) { + t.Parallel() assert := assert.New(t) testcases := []struct { fmtp string @@ -70,6 +71,7 @@ func TestGetFmtpValueH264(t *testing.T) { } func TestGetFmtpValueVP9(t *testing.T) { + t.Parallel() assert := assert.New(t) testcases := []struct { fmtp string diff --git a/mcu_janus_test.go b/mcu_janus_test.go index 99eab18..2e231e4 100644 --- a/mcu_janus_test.go +++ b/mcu_janus_test.go @@ -40,6 +40,7 @@ import ( ) func TestMcuJanusStats(t *testing.T) { + t.Parallel() collectAndLint(t, janusMcuStats...) } @@ -1080,7 +1081,7 @@ func Test_JanusPublisherGetStreamsAudioVideo(t *testing.T) { } } -func Test_JanusPublisherSubscriber(t *testing.T) { +func Test_JanusPublisherSubscriber(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsJanusBandwidthCurrent.WithLabelValues("incoming")) ResetStatsValue(t, statsJanusBandwidthCurrent.WithLabelValues("outgoing")) @@ -1395,7 +1396,7 @@ func Test_JanusRemotePublisher(t *testing.T) { assert.EqualValues(1, removed.Load()) } -func Test_JanusSubscriberNoSuchRoom(t *testing.T) { +func Test_JanusSubscriberNoSuchRoom(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { @@ -1494,7 +1495,7 @@ func Test_JanusSubscriberNoSuchRoom(t *testing.T) { client2.RunUntilOffer(ctx, MockSdpOfferAudioAndVideo) } -func test_JanusSubscriberAlreadyJoined(t *testing.T) { +func test_JanusSubscriberAlreadyJoined(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { @@ -1595,15 +1596,15 @@ func test_JanusSubscriberAlreadyJoined(t *testing.T) { client2.RunUntilOffer(ctx, MockSdpOfferAudioAndVideo) } -func Test_JanusSubscriberAlreadyJoined(t *testing.T) { +func Test_JanusSubscriberAlreadyJoined(t *testing.T) { // nolint:paralleltest test_JanusSubscriberAlreadyJoined(t) } -func Test_JanusSubscriberAlreadyJoinedAttachError(t *testing.T) { +func Test_JanusSubscriberAlreadyJoinedAttachError(t *testing.T) { // nolint:paralleltest test_JanusSubscriberAlreadyJoined(t) } -func Test_JanusSubscriberTimeout(t *testing.T) { +func Test_JanusSubscriberTimeout(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { @@ -1706,7 +1707,7 @@ func Test_JanusSubscriberTimeout(t *testing.T) { client2.RunUntilOffer(ctx, MockSdpOfferAudioAndVideo) } -func Test_JanusSubscriberCloseEmptyStreams(t *testing.T) { +func Test_JanusSubscriberCloseEmptyStreams(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { @@ -1816,7 +1817,7 @@ func Test_JanusSubscriberCloseEmptyStreams(t *testing.T) { assert.Nil(handle, "subscriber should have been closed") } -func Test_JanusSubscriberRoomDestroyed(t *testing.T) { +func Test_JanusSubscriberRoomDestroyed(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { @@ -1926,7 +1927,7 @@ func Test_JanusSubscriberRoomDestroyed(t *testing.T) { assert.Nil(handle, "subscriber should have been closed") } -func Test_JanusSubscriberUpdateOffer(t *testing.T) { +func Test_JanusSubscriberUpdateOffer(t *testing.T) { // nolint:paralleltest ResetStatsValue(t, statsSubscribersCurrent.WithLabelValues("video")) t.Cleanup(func() { if !t.Failed() { diff --git a/mcu_proxy_test.go b/mcu_proxy_test.go index 258f92a..48a34c5 100644 --- a/mcu_proxy_test.go +++ b/mcu_proxy_test.go @@ -54,6 +54,7 @@ const ( ) func TestMcuProxyStats(t *testing.T) { + t.Parallel() collectAndLint(t, proxyMcuStats...) } @@ -64,6 +65,7 @@ func newProxyConnectionWithCountry(country string) *mcuProxyConnection { } func Test_sortConnectionsForCountry(t *testing.T) { + t.Parallel() conn_de := newProxyConnectionWithCountry("DE") conn_at := newProxyConnectionWithCountry("AT") conn_jp := newProxyConnectionWithCountry("JP") @@ -109,6 +111,7 @@ func Test_sortConnectionsForCountry(t *testing.T) { for country, test := range testcases { t.Run(country, func(t *testing.T) { + t.Parallel() sorted := sortConnectionsForCountry(test[0], country, nil) for idx, conn := range sorted { assert.Equal(t, test[1][idx], conn, "Index %d for %s: expected %s, got %s", idx, country, test[1][idx].Country(), conn.Country()) @@ -118,6 +121,7 @@ func Test_sortConnectionsForCountry(t *testing.T) { } func Test_sortConnectionsForCountryWithOverride(t *testing.T) { + t.Parallel() conn_de := newProxyConnectionWithCountry("DE") conn_at := newProxyConnectionWithCountry("AT") conn_jp := newProxyConnectionWithCountry("JP") @@ -179,6 +183,7 @@ func Test_sortConnectionsForCountryWithOverride(t *testing.T) { } for country, test := range testcases { t.Run(country, func(t *testing.T) { + t.Parallel() sorted := sortConnectionsForCountry(test[0], country, continentMap) for idx, conn := range sorted { assert.Equal(t, test[1][idx], conn, "Index %d for %s: expected %s, got %s", idx, country, test[1][idx].Country(), conn.Country()) @@ -1017,7 +1022,7 @@ func Test_ProxyAddRemoveConnections(t *testing.T) { assert.NoError(waitCtx.Err(), "error while waiting for connection to be removed") } -func Test_ProxyAddRemoveConnectionsDnsDiscovery(t *testing.T) { +func Test_ProxyAddRemoveConnectionsDnsDiscovery(t *testing.T) { // nolint:paralleltest assert := assert.New(t) require := require.New(t) @@ -2438,6 +2443,7 @@ func Test_ProxySubscriberTimeout(t *testing.T) { } func Test_ProxyReconnectAfter(t *testing.T) { + t.Parallel() reasons := []string{ "session_resumed", "session_expired", diff --git a/natsclient_loopback_test.go b/natsclient_loopback_test.go index 9a299ca..b403109 100644 --- a/natsclient_loopback_test.go +++ b/natsclient_loopback_test.go @@ -63,7 +63,7 @@ func CreateLoopbackNatsClientForTest(t *testing.T) NatsClient { return result } -func TestLoopbackNatsClient_Subscribe(t *testing.T) { +func TestLoopbackNatsClient_Subscribe(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { client := CreateLoopbackNatsClientForTest(t) @@ -71,7 +71,7 @@ func TestLoopbackNatsClient_Subscribe(t *testing.T) { }) } -func TestLoopbackClient_PublishAfterClose(t *testing.T) { +func TestLoopbackClient_PublishAfterClose(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { client := CreateLoopbackNatsClientForTest(t) @@ -79,7 +79,7 @@ func TestLoopbackClient_PublishAfterClose(t *testing.T) { }) } -func TestLoopbackClient_SubscribeAfterClose(t *testing.T) { +func TestLoopbackClient_SubscribeAfterClose(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { client := CreateLoopbackNatsClientForTest(t) @@ -87,7 +87,7 @@ func TestLoopbackClient_SubscribeAfterClose(t *testing.T) { }) } -func TestLoopbackClient_BadSubjects(t *testing.T) { +func TestLoopbackClient_BadSubjects(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { client := CreateLoopbackNatsClientForTest(t) diff --git a/natsclient_test.go b/natsclient_test.go index 766e123..a852b9f 100644 --- a/natsclient_test.go +++ b/natsclient_test.go @@ -110,7 +110,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) { require.EqualValues(maxPublish, received.Load(), "Received wrong # of messages") } -func TestNatsClient_Subscribe(t *testing.T) { +func TestNatsClient_Subscribe(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { _, _, client := CreateLocalNatsClientForTest(t) @@ -124,7 +124,7 @@ func testNatsClient_PublishAfterClose(t *testing.T, client NatsClient) { assert.ErrorIs(t, client.Publish("foo", "bar"), nats.ErrConnectionClosed) } -func TestNatsClient_PublishAfterClose(t *testing.T) { +func TestNatsClient_PublishAfterClose(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { _, _, client := CreateLocalNatsClientForTest(t) @@ -140,7 +140,7 @@ func testNatsClient_SubscribeAfterClose(t *testing.T, client NatsClient) { assert.ErrorIs(t, err, nats.ErrConnectionClosed) } -func TestNatsClient_SubscribeAfterClose(t *testing.T) { +func TestNatsClient_SubscribeAfterClose(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { _, _, client := CreateLocalNatsClientForTest(t) @@ -162,7 +162,7 @@ func testNatsClient_BadSubjects(t *testing.T, client NatsClient) { } } -func TestNatsClient_BadSubjects(t *testing.T) { +func TestNatsClient_BadSubjects(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { _, _, client := CreateLocalNatsClientForTest(t) @@ -170,7 +170,7 @@ func TestNatsClient_BadSubjects(t *testing.T) { }) } -func TestNatsClient_MaxReconnects(t *testing.T) { +func TestNatsClient_MaxReconnects(t *testing.T) { // nolint:paralleltest ensureNoGoroutinesLeak(t, func(t *testing.T) { assert := assert.New(t) require := require.New(t) diff --git a/notifier_test.go b/notifier_test.go index ea61dcd..538a4f5 100644 --- a/notifier_test.go +++ b/notifier_test.go @@ -32,6 +32,7 @@ import ( ) func TestNotifierNoWaiter(t *testing.T) { + t.Parallel() var notifier Notifier // Notifications can be sent even if no waiter exists. @@ -39,6 +40,7 @@ func TestNotifierNoWaiter(t *testing.T) { } func TestNotifierSimple(t *testing.T) { + t.Parallel() var notifier Notifier var wg sync.WaitGroup @@ -59,6 +61,7 @@ func TestNotifierSimple(t *testing.T) { } func TestNotifierMultiNotify(t *testing.T) { + t.Parallel() var notifier Notifier waiter := notifier.NewWaiter("foo") @@ -70,6 +73,7 @@ func TestNotifierMultiNotify(t *testing.T) { } func TestNotifierWaitClosed(t *testing.T) { + t.Parallel() var notifier Notifier waiter := notifier.NewWaiter("foo") @@ -79,6 +83,7 @@ func TestNotifierWaitClosed(t *testing.T) { } func TestNotifierWaitClosedMulti(t *testing.T) { + t.Parallel() var notifier Notifier waiter1 := notifier.NewWaiter("foo") @@ -91,6 +96,7 @@ func TestNotifierWaitClosedMulti(t *testing.T) { } func TestNotifierResetWillNotify(t *testing.T) { + t.Parallel() var notifier Notifier var wg sync.WaitGroup @@ -111,6 +117,7 @@ func TestNotifierResetWillNotify(t *testing.T) { } func TestNotifierDuplicate(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { var notifier Notifier var done sync.WaitGroup diff --git a/proxy/proxy_remote_test.go b/proxy/proxy_remote_test.go index 75515f1..0c98002 100644 --- a/proxy/proxy_remote_test.go +++ b/proxy/proxy_remote_test.go @@ -74,6 +74,7 @@ func (c *RemoteConnection) WaitForDisconnect(ctx context.Context) error { } func Test_ProxyRemoteConnectionReconnect(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -101,6 +102,7 @@ func Test_ProxyRemoteConnectionReconnect(t *testing.T) { } func Test_ProxyRemoteConnectionReconnectUnknownSession(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -143,6 +145,7 @@ func Test_ProxyRemoteConnectionReconnectUnknownSession(t *testing.T) { } func Test_ProxyRemoteConnectionReconnectExpiredSession(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) @@ -178,6 +181,7 @@ func Test_ProxyRemoteConnectionReconnectExpiredSession(t *testing.T) { } func Test_ProxyRemoteConnectionCreatePublisher(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) diff --git a/proxy/proxy_server_test.go b/proxy/proxy_server_test.go index 76b9b3d..aef00ab 100644 --- a/proxy/proxy_server_test.go +++ b/proxy/proxy_server_test.go @@ -152,6 +152,7 @@ func newProxyServerForTest(t *testing.T) (*ProxyServer, *rsa.PrivateKey, *httpte } func TestTokenValid(t *testing.T) { + t.Parallel() proxy, key, _ := newProxyServerForTest(t) claims := &signaling.TokenClaims{ @@ -174,6 +175,7 @@ func TestTokenValid(t *testing.T) { } func TestTokenNotSigned(t *testing.T) { + t.Parallel() proxy, _, _ := newProxyServerForTest(t) claims := &signaling.TokenClaims{ @@ -198,6 +200,7 @@ func TestTokenNotSigned(t *testing.T) { } func TestTokenUnknown(t *testing.T) { + t.Parallel() proxy, key, _ := newProxyServerForTest(t) claims := &signaling.TokenClaims{ @@ -222,6 +225,7 @@ func TestTokenUnknown(t *testing.T) { } func TestTokenInFuture(t *testing.T) { + t.Parallel() proxy, key, _ := newProxyServerForTest(t) claims := &signaling.TokenClaims{ @@ -246,6 +250,7 @@ func TestTokenInFuture(t *testing.T) { } func TestTokenExpired(t *testing.T) { + t.Parallel() proxy, key, _ := newProxyServerForTest(t) claims := &signaling.TokenClaims{ @@ -270,6 +275,7 @@ func TestTokenExpired(t *testing.T) { } func TestPublicIPs(t *testing.T) { + t.Parallel() assert := assert.New(t) public := []string{ "8.8.8.8", @@ -302,6 +308,7 @@ func TestPublicIPs(t *testing.T) { } func TestWebsocketFeatures(t *testing.T) { + t.Parallel() assert := assert.New(t) _, _, server := newProxyServerForTest(t) @@ -329,6 +336,7 @@ func TestWebsocketFeatures(t *testing.T) { } func TestProxyCreateSession(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) _, key, server := newProxyServerForTest(t) @@ -480,6 +488,7 @@ func NewPublisherTestMCU(t *testing.T) *PublisherTestMCU { } func TestProxyPublisherBandwidth(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -599,6 +608,7 @@ func (m *HangingTestMCU) NewSubscriber(ctx context.Context, listener signaling.M } func TestProxyCancelOnClose(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -677,6 +687,7 @@ func (m *CodecsTestMCU) NewPublisher(ctx context.Context, listener signaling.Mcu } func TestProxyCodecs(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -759,6 +770,7 @@ func NewStreamTestMCU(t *testing.T, streams []signaling.PublisherStream) *Stream } func TestProxyStreams(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -983,6 +995,7 @@ func (m *RemoteSubscriberTestMCU) NewRemoteSubscriber(ctx context.Context, liste } func TestProxyRemoteSubscriber(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -1077,6 +1090,7 @@ func TestProxyRemoteSubscriber(t *testing.T) { } func TestProxyCloseRemoteOnSessionClose(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -1239,6 +1253,7 @@ func (p *UnpublishRemoteTestPublisher) UnpublishRemote(ctx context.Context, remo } func TestProxyUnpublishRemote(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -1355,6 +1370,7 @@ func TestProxyUnpublishRemote(t *testing.T) { } func TestProxyUnpublishRemotePublisherClosed(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) @@ -1486,6 +1502,7 @@ func TestProxyUnpublishRemotePublisherClosed(t *testing.T) { } func TestProxyUnpublishRemoteOnSessionClose(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) proxy, key, server := newProxyServerForTest(t) diff --git a/proxy/proxy_tokens_etcd_test.go b/proxy/proxy_tokens_etcd_test.go index 4161d12..4d0b845 100644 --- a/proxy/proxy_tokens_etcd_test.go +++ b/proxy/proxy_tokens_etcd_test.go @@ -159,6 +159,7 @@ func generateAndSaveKey(t *testing.T, etcd *embed.Etcd, name string) *rsa.Privat } func TestProxyTokensEtcd(t *testing.T) { + t.Parallel() assert := assert.New(t) tokens, etcd := newTokensEtcdForTesting(t) diff --git a/proxy_config_static_test.go b/proxy_config_static_test.go index 5354d48..7c4de25 100644 --- a/proxy_config_static_test.go +++ b/proxy_config_static_test.go @@ -57,6 +57,7 @@ func updateProxyConfigStatic(t *testing.T, config ProxyConfig, dns bool, urls .. } func TestProxyConfigStaticSimple(t *testing.T) { + t.Parallel() proxy := newMcuProxyForConfig(t) config, _ := newProxyConfigStatic(t, proxy, false, "https://foo/") proxy.Expect("add", "https://foo/") @@ -72,7 +73,7 @@ func TestProxyConfigStaticSimple(t *testing.T) { updateProxyConfigStatic(t, config, false, "https://bar/", "https://baz/") } -func TestProxyConfigStaticDNS(t *testing.T) { +func TestProxyConfigStaticDNS(t *testing.T) { // nolint:paralleltest lookup := newMockDnsLookupForTest(t) proxy := newMcuProxyForConfig(t) config, dnsMonitor := newProxyConfigStatic(t, proxy, true, "https://foo/") diff --git a/publisher_stats_counter_test.go b/publisher_stats_counter_test.go index 975089b..be7a1ad 100644 --- a/publisher_stats_counter_test.go +++ b/publisher_stats_counter_test.go @@ -25,7 +25,7 @@ import ( "testing" ) -func TestPublisherStatsCounter(t *testing.T) { +func TestPublisherStatsCounter(t *testing.T) { // nolint:paralleltest RegisterJanusMcuStats() var c publisherStatsCounter diff --git a/room_ping_test.go b/room_ping_test.go index a89f536..b452da8 100644 --- a/room_ping_test.go +++ b/room_ping_test.go @@ -58,6 +58,7 @@ func NewRoomPingForTest(ctx context.Context, t *testing.T) (*url.URL, *RoomPing) } func TestSingleRoomPing(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) assert := assert.New(t) @@ -101,6 +102,7 @@ func TestSingleRoomPing(t *testing.T) { } func TestMultiRoomPing(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) assert := assert.New(t) @@ -140,6 +142,7 @@ func TestMultiRoomPing(t *testing.T) { } func TestMultiRoomPing_Separate(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) assert := assert.New(t) @@ -175,6 +178,7 @@ func TestMultiRoomPing_Separate(t *testing.T) { } func TestMultiRoomPing_DeleteRoom(t *testing.T) { + t.Parallel() logger := NewLoggerForTest(t) ctx := NewLoggerContext(t.Context(), logger) assert := assert.New(t) diff --git a/room_test.go b/room_test.go index 8901d0b..5622cd6 100644 --- a/room_test.go +++ b/room_test.go @@ -37,6 +37,7 @@ import ( ) func TestRoom_InCall(t *testing.T) { + t.Parallel() type Testcase struct { Value any InCall bool diff --git a/roomsessions_builtin_test.go b/roomsessions_builtin_test.go index c69e346..02a6162 100644 --- a/roomsessions_builtin_test.go +++ b/roomsessions_builtin_test.go @@ -28,6 +28,7 @@ import ( ) func TestBuiltinRoomSessions(t *testing.T) { + t.Parallel() sessions, err := NewBuiltinRoomSessions(nil) require.NoError(t, err) diff --git a/sessionid_codec_test.go b/sessionid_codec_test.go index 1176d3c..47317c8 100644 --- a/sessionid_codec_test.go +++ b/sessionid_codec_test.go @@ -30,6 +30,7 @@ import ( ) func TestReverseSessionId(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) codec, err := NewSessionIdCodec([]byte("12345678901234567890123456789012"), []byte("09876543210987654321098765432109")) @@ -127,6 +128,7 @@ func Benchmark_DecodePublicSessionId(b *testing.B) { } func TestPublicPrivate(t *testing.T) { + t.Parallel() assert := assert.New(t) require := require.New(t) sd := &SessionIdData{ diff --git a/single_notifier_test.go b/single_notifier_test.go index 55872cf..2041b25 100644 --- a/single_notifier_test.go +++ b/single_notifier_test.go @@ -32,6 +32,7 @@ import ( ) func TestSingleNotifierNoWaiter(t *testing.T) { + t.Parallel() var notifier SingleNotifier // Notifications can be sent even if no waiter exists. @@ -39,6 +40,7 @@ func TestSingleNotifierNoWaiter(t *testing.T) { } func TestSingleNotifierSimple(t *testing.T) { + t.Parallel() var notifier SingleNotifier var wg sync.WaitGroup @@ -59,6 +61,7 @@ func TestSingleNotifierSimple(t *testing.T) { } func TestSingleNotifierMultiNotify(t *testing.T) { + t.Parallel() var notifier SingleNotifier waiter := notifier.NewWaiter() @@ -70,6 +73,7 @@ func TestSingleNotifierMultiNotify(t *testing.T) { } func TestSingleNotifierWaitClosed(t *testing.T) { + t.Parallel() var notifier SingleNotifier waiter := notifier.NewWaiter() @@ -79,6 +83,7 @@ func TestSingleNotifierWaitClosed(t *testing.T) { } func TestSingleNotifierWaitClosedMulti(t *testing.T) { + t.Parallel() var notifier SingleNotifier waiter1 := notifier.NewWaiter() @@ -91,6 +96,7 @@ func TestSingleNotifierWaitClosedMulti(t *testing.T) { } func TestSingleNotifierResetWillNotify(t *testing.T) { + t.Parallel() var notifier SingleNotifier var wg sync.WaitGroup @@ -111,6 +117,7 @@ func TestSingleNotifierResetWillNotify(t *testing.T) { } func TestSingleNotifierDuplicate(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { var notifier SingleNotifier var done sync.WaitGroup diff --git a/throttle_test.go b/throttle_test.go index 07f3520..935aecf 100644 --- a/throttle_test.go +++ b/throttle_test.go @@ -67,6 +67,7 @@ func expectDelay(t *testing.T, f func(), delay time.Duration) { } func TestThrottler(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) @@ -101,6 +102,7 @@ func TestThrottler(t *testing.T) { } func TestThrottlerIPv6(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) @@ -138,6 +140,7 @@ func TestThrottlerIPv6(t *testing.T) { } func TestThrottler_Bruteforce(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) @@ -164,6 +167,7 @@ func TestThrottler_Bruteforce(t *testing.T) { } func TestThrottler_Cleanup(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) throttler := newMemoryThrottlerForTest(t) @@ -220,6 +224,7 @@ func TestThrottler_Cleanup(t *testing.T) { } func TestThrottler_ExpirePartial(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) @@ -252,6 +257,7 @@ func TestThrottler_ExpirePartial(t *testing.T) { } func TestThrottler_ExpireAll(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) @@ -284,6 +290,7 @@ func TestThrottler_ExpireAll(t *testing.T) { } func TestThrottler_Negative(t *testing.T) { + t.Parallel() SynctestTest(t, func(t *testing.T) { assert := assert.New(t) th := newMemoryThrottlerForTest(t) diff --git a/transient_data_test.go b/transient_data_test.go index 742d178..e2bee37 100644 --- a/transient_data_test.go +++ b/transient_data_test.go @@ -42,6 +42,7 @@ func (t *TransientData) SetTTLChannel(ch chan<- struct{}) { } func Test_TransientData(t *testing.T) { + t.Parallel() assert := assert.New(t) data := NewTransientData() assert.False(data.Set("foo", nil)) @@ -119,6 +120,7 @@ func (l *MockTransientListener) Close() { } func Test_TransientDataDeadlock(t *testing.T) { + t.Parallel() data := NewTransientData() listener := &MockTransientListener{ @@ -139,6 +141,7 @@ func Test_TransientDataDeadlock(t *testing.T) { } func Test_TransientMessages(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel() @@ -313,6 +316,7 @@ func Test_TransientMessages(t *testing.T) { } func Test_TransientSessionData(t *testing.T) { + t.Parallel() for _, subtest := range clusteredTests { t.Run(subtest, func(t *testing.T) { t.Parallel()