Run tests in parallel where possible.

This commit is contained in:
Joachim Bauch 2025-12-04 12:23:14 +01:00
commit 4986122493
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
44 changed files with 240 additions and 69 deletions

View file

@ -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)

View file

@ -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{

View file

@ -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)

View file

@ -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")

View file

@ -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)

View file

@ -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

View file

@ -28,6 +28,7 @@ import (
)
func TestChannelWaiters(t *testing.T) {
t.Parallel()
var waiters ChannelWaiters
ch1 := make(chan struct{}, 1)

View file

@ -30,6 +30,7 @@ import (
)
func TestStats(t *testing.T) {
t.Parallel()
assert := assert.New(t)
var stats Stats

View file

@ -29,6 +29,7 @@ import (
)
func TestCounterWriter(t *testing.T) {
t.Parallel()
assert := assert.New(t)
var b bytes.Buffer

View file

@ -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
}

View file

@ -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())

View file

@ -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())

View file

@ -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()

View file

@ -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")

View file

@ -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)

View file

@ -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)

View file

@ -30,6 +30,7 @@ import (
)
func TestFlags(t *testing.T) {
t.Parallel()
assert := assert.New(t)
var f Flags
assert.EqualValues(0, f.Get())

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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",

View file

@ -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)

View file

@ -28,6 +28,7 @@ import (
)
func TestCommonMcuStats(t *testing.T) {
t.Parallel()
collectAndLint(t, commonMcuStats...)
}

View file

@ -498,6 +498,7 @@ func TestJanusEventsHandlerDifferentTypes(t *testing.T) {
}
func TestJanusEventsHandlerNotGrouped(t *testing.T) {
t.Parallel()
require := require.New(t)
assert := assert.New(t)

View file

@ -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

View file

@ -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() {

View file

@ -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",

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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/")

View file

@ -25,7 +25,7 @@ import (
"testing"
)
func TestPublisherStatsCounter(t *testing.T) {
func TestPublisherStatsCounter(t *testing.T) { // nolint:paralleltest
RegisterJanusMcuStats()
var c publisherStatsCounter

View file

@ -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)

View file

@ -37,6 +37,7 @@ import (
)
func TestRoom_InCall(t *testing.T) {
t.Parallel()
type Testcase struct {
Value any
InCall bool

View file

@ -28,6 +28,7 @@ import (
)
func TestBuiltinRoomSessions(t *testing.T) {
t.Parallel()
sessions, err := NewBuiltinRoomSessions(nil)
require.NoError(t, err)

View file

@ -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{

View file

@ -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

View file

@ -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)

View file

@ -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()