mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-18 13:36:34 +02:00
Run tests in parallel and catch log output from tests.
This commit is contained in:
parent
cad397e59e
commit
0eb234b24d
|
@ -27,6 +27,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBackendChecksum(t *testing.T) {
|
func TestBackendChecksum(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
rnd := newRandomString(32)
|
rnd := newRandomString(32)
|
||||||
body := []byte{1, 2, 3, 4, 5}
|
body := []byte{1, 2, 3, 4, 5}
|
||||||
secret := []byte("shared-secret")
|
secret := []byte("shared-secret")
|
||||||
|
@ -58,6 +59,7 @@ func TestBackendChecksum(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidNumbers(t *testing.T) {
|
func TestValidNumbers(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
valid := []string{
|
valid := []string{
|
||||||
"+12",
|
"+12",
|
||||||
"+12345",
|
"+12345",
|
||||||
|
|
|
@ -81,6 +81,7 @@ func testMessages(t *testing.T, messageType string, valid_messages []testCheckVa
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessage(t *testing.T) {
|
func TestClientMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// The message needs a type.
|
// The message needs a type.
|
||||||
msg := ClientMessage{}
|
msg := ClientMessage{}
|
||||||
if err := msg.CheckValid(); err == nil {
|
if err := msg.CheckValid(); err == nil {
|
||||||
|
@ -89,6 +90,7 @@ func TestClientMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHelloClientMessage(t *testing.T) {
|
func TestHelloClientMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
internalAuthParams := []byte("{\"backend\":\"https://domain.invalid\"}")
|
internalAuthParams := []byte("{\"backend\":\"https://domain.invalid\"}")
|
||||||
tokenAuthParams := []byte("{\"token\":\"invalid-token\"}")
|
tokenAuthParams := []byte("{\"token\":\"invalid-token\"}")
|
||||||
valid_messages := []testCheckValid{
|
valid_messages := []testCheckValid{
|
||||||
|
@ -233,6 +235,7 @@ func TestHelloClientMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMessageClientMessage(t *testing.T) {
|
func TestMessageClientMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
valid_messages := []testCheckValid{
|
valid_messages := []testCheckValid{
|
||||||
&MessageClientMessage{
|
&MessageClientMessage{
|
||||||
Recipient: MessageClientMessageRecipient{
|
Recipient: MessageClientMessageRecipient{
|
||||||
|
@ -314,6 +317,7 @@ func TestMessageClientMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestByeClientMessage(t *testing.T) {
|
func TestByeClientMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// Any "bye" message is valid.
|
// Any "bye" message is valid.
|
||||||
valid_messages := []testCheckValid{
|
valid_messages := []testCheckValid{
|
||||||
&ByeClientMessage{},
|
&ByeClientMessage{},
|
||||||
|
@ -332,6 +336,7 @@ func TestByeClientMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoomClientMessage(t *testing.T) {
|
func TestRoomClientMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// Any "room" message is valid.
|
// Any "room" message is valid.
|
||||||
valid_messages := []testCheckValid{
|
valid_messages := []testCheckValid{
|
||||||
&RoomClientMessage{},
|
&RoomClientMessage{},
|
||||||
|
@ -350,6 +355,7 @@ func TestRoomClientMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestErrorMessages(t *testing.T) {
|
func TestErrorMessages(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
id := "request-id"
|
id := "request-id"
|
||||||
msg := ClientMessage{
|
msg := ClientMessage{
|
||||||
Id: id,
|
Id: id,
|
||||||
|
@ -382,6 +388,7 @@ func TestErrorMessages(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsChatRefresh(t *testing.T) {
|
func TestIsChatRefresh(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var msg ServerMessage
|
var msg ServerMessage
|
||||||
data_true := []byte("{\"type\":\"chat\",\"chat\":{\"refresh\":true}}")
|
data_true := []byte("{\"type\":\"chat\",\"chat\":{\"refresh\":true}}")
|
||||||
msg = ServerMessage{
|
msg = ServerMessage{
|
||||||
|
@ -426,6 +433,7 @@ func assertEqualStrings(t *testing.T, expected, result []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_Welcome_AddRemoveFeature(t *testing.T) {
|
func Test_Welcome_AddRemoveFeature(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var msg WelcomeServerMessage
|
var msg WelcomeServerMessage
|
||||||
assertEqualStrings(t, []string{}, msg.Features)
|
assertEqualStrings(t, []string{}, msg.Features)
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,8 @@ func returnOCS(t *testing.T, w http.ResponseWriter, body []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPostOnRedirect(t *testing.T) {
|
func TestPostOnRedirect(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, "/ocs/v2.php/two", http.StatusTemporaryRedirect)
|
http.Redirect(w, r, "/ocs/v2.php/two", http.StatusTemporaryRedirect)
|
||||||
|
@ -125,6 +127,8 @@ func TestPostOnRedirect(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPostOnRedirectDifferentHost(t *testing.T) {
|
func TestPostOnRedirectDifferentHost(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, "http://domain.invalid/ocs/v2.php/two", http.StatusTemporaryRedirect)
|
http.Redirect(w, r, "http://domain.invalid/ocs/v2.php/two", http.StatusTemporaryRedirect)
|
||||||
|
@ -165,6 +169,8 @@ func TestPostOnRedirectDifferentHost(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPostOnRedirectStatusFound(t *testing.T) {
|
func TestPostOnRedirectStatusFound(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, "/ocs/v2.php/two", http.StatusFound)
|
http.Redirect(w, r, "/ocs/v2.php/two", http.StatusFound)
|
||||||
|
@ -217,6 +223,8 @@ func TestPostOnRedirectStatusFound(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHandleThrottled(t *testing.T) {
|
func TestHandleThrottled(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/ocs/v2.php/one", func(w http.ResponseWriter, r *http.Request) {
|
||||||
returnOCS(t, w, []byte("[]"))
|
returnOCS(t, w, []byte("[]"))
|
||||||
|
|
|
@ -92,6 +92,7 @@ func testBackends(t *testing.T, config *BackendConfiguration, valid_urls [][]str
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsUrlAllowed_Compat(t *testing.T) {
|
func TestIsUrlAllowed_Compat(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
// Old-style configuration
|
// Old-style configuration
|
||||||
valid_urls := []string{
|
valid_urls := []string{
|
||||||
"http://domain.invalid",
|
"http://domain.invalid",
|
||||||
|
@ -114,6 +115,7 @@ func TestIsUrlAllowed_Compat(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsUrlAllowed_CompatForceHttps(t *testing.T) {
|
func TestIsUrlAllowed_CompatForceHttps(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
// Old-style configuration, force HTTPS
|
// Old-style configuration, force HTTPS
|
||||||
valid_urls := []string{
|
valid_urls := []string{
|
||||||
"https://domain.invalid",
|
"https://domain.invalid",
|
||||||
|
@ -135,6 +137,7 @@ func TestIsUrlAllowed_CompatForceHttps(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsUrlAllowed(t *testing.T) {
|
func TestIsUrlAllowed(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
valid_urls := [][]string{
|
valid_urls := [][]string{
|
||||||
{"https://domain.invalid/foo", string(testBackendSecret) + "-foo"},
|
{"https://domain.invalid/foo", string(testBackendSecret) + "-foo"},
|
||||||
{"https://domain.invalid/foo/", string(testBackendSecret) + "-foo"},
|
{"https://domain.invalid/foo/", string(testBackendSecret) + "-foo"},
|
||||||
|
@ -180,6 +183,7 @@ func TestIsUrlAllowed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsUrlAllowed_EmptyAllowlist(t *testing.T) {
|
func TestIsUrlAllowed_EmptyAllowlist(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
valid_urls := []string{}
|
valid_urls := []string{}
|
||||||
invalid_urls := []string{
|
invalid_urls := []string{
|
||||||
"http://domain.invalid",
|
"http://domain.invalid",
|
||||||
|
@ -197,6 +201,7 @@ func TestIsUrlAllowed_EmptyAllowlist(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsUrlAllowed_AllowAll(t *testing.T) {
|
func TestIsUrlAllowed_AllowAll(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
valid_urls := []string{
|
valid_urls := []string{
|
||||||
"http://domain.invalid",
|
"http://domain.invalid",
|
||||||
"https://domain.invalid",
|
"https://domain.invalid",
|
||||||
|
@ -222,6 +227,7 @@ type ParseBackendIdsTestcase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseBackendIds(t *testing.T) {
|
func TestParseBackendIds(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
testcases := []ParseBackendIdsTestcase{
|
testcases := []ParseBackendIdsTestcase{
|
||||||
{"", nil},
|
{"", nil},
|
||||||
{"backend1", []string{"backend1"}},
|
{"backend1", []string{"backend1"}},
|
||||||
|
@ -241,6 +247,7 @@ func TestParseBackendIds(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadNoChange(t *testing.T) {
|
func TestBackendReloadNoChange(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1, backend2")
|
original_config.AddOption("backend", "backends", "backend1, backend2")
|
||||||
|
@ -276,6 +283,7 @@ func TestBackendReloadNoChange(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadChangeExistingURL(t *testing.T) {
|
func TestBackendReloadChangeExistingURL(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1, backend2")
|
original_config.AddOption("backend", "backends", "backend1, backend2")
|
||||||
|
@ -316,6 +324,7 @@ func TestBackendReloadChangeExistingURL(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadChangeSecret(t *testing.T) {
|
func TestBackendReloadChangeSecret(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1, backend2")
|
original_config.AddOption("backend", "backends", "backend1, backend2")
|
||||||
|
@ -354,6 +363,7 @@ func TestBackendReloadChangeSecret(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadAddBackend(t *testing.T) {
|
func TestBackendReloadAddBackend(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1")
|
original_config.AddOption("backend", "backends", "backend1")
|
||||||
|
@ -394,6 +404,7 @@ func TestBackendReloadAddBackend(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadRemoveHost(t *testing.T) {
|
func TestBackendReloadRemoveHost(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1, backend2")
|
original_config.AddOption("backend", "backends", "backend1, backend2")
|
||||||
|
@ -431,6 +442,7 @@ func TestBackendReloadRemoveHost(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendReloadRemoveBackendFromSharedHost(t *testing.T) {
|
func TestBackendReloadRemoveBackendFromSharedHost(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
current := testutil.ToFloat64(statsBackendsCurrent)
|
current := testutil.ToFloat64(statsBackendsCurrent)
|
||||||
original_config := goconf.NewConfigFile()
|
original_config := goconf.NewConfigFile()
|
||||||
original_config.AddOption("backend", "backends", "backend1, backend2")
|
original_config.AddOption("backend", "backends", "backend1, backend2")
|
||||||
|
@ -486,6 +498,8 @@ func mustParse(s string) *url.URL {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendConfiguration_Etcd(t *testing.T) {
|
func TestBackendConfiguration_Etcd(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd, client := NewEtcdClientForTest(t)
|
etcd, client := NewEtcdClientForTest(t)
|
||||||
|
|
||||||
url1 := "https://domain1.invalid/foo"
|
url1 := "https://domain1.invalid/foo"
|
||||||
|
@ -619,6 +633,8 @@ func TestBackendConfiguration_Etcd(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendCommonSecret(t *testing.T) {
|
func TestBackendCommonSecret(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
u1, err := url.Parse("http://domain1.invalid")
|
u1, err := url.Parse("http://domain1.invalid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -275,6 +275,8 @@ func expectRoomlistEvent(ch chan *AsyncMessage, msgType string) (*EventServerMes
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_NoAuth(t *testing.T) {
|
func TestBackendServer_NoAuth(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -301,6 +303,8 @@ func TestBackendServer_NoAuth(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_InvalidAuth(t *testing.T) {
|
func TestBackendServer_InvalidAuth(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -329,6 +333,8 @@ func TestBackendServer_InvalidAuth(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_OldCompatAuth(t *testing.T) {
|
func TestBackendServer_OldCompatAuth(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -378,6 +384,8 @@ func TestBackendServer_OldCompatAuth(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_InvalidBody(t *testing.T) {
|
func TestBackendServer_InvalidBody(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -397,6 +405,8 @@ func TestBackendServer_InvalidBody(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_UnsupportedRequest(t *testing.T) {
|
func TestBackendServer_UnsupportedRequest(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
_, _, _, _, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
msg := &BackendServerRoomRequest{
|
msg := &BackendServerRoomRequest{
|
||||||
|
@ -423,8 +433,10 @@ func TestBackendServer_UnsupportedRequest(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomInvite(t *testing.T) {
|
func TestBackendServer_RoomInvite(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, backend := range eventBackendsForTest {
|
for _, backend := range eventBackendsForTest {
|
||||||
t.Run(backend, func(t *testing.T) {
|
t.Run(backend, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
RunTestBackendServer_RoomInvite(t)
|
RunTestBackendServer_RoomInvite(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -503,8 +515,10 @@ func RunTestBackendServer_RoomInvite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomDisinvite(t *testing.T) {
|
func TestBackendServer_RoomDisinvite(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, backend := range eventBackendsForTest {
|
for _, backend := range eventBackendsForTest {
|
||||||
t.Run(backend, func(t *testing.T) {
|
t.Run(backend, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
RunTestBackendServer_RoomDisinvite(t)
|
RunTestBackendServer_RoomDisinvite(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -616,6 +630,8 @@ func RunTestBackendServer_RoomDisinvite(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomDisinviteDifferentRooms(t *testing.T) {
|
func TestBackendServer_RoomDisinviteDifferentRooms(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -741,8 +757,10 @@ func TestBackendServer_RoomDisinviteDifferentRooms(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomUpdate(t *testing.T) {
|
func TestBackendServer_RoomUpdate(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, backend := range eventBackendsForTest {
|
for _, backend := range eventBackendsForTest {
|
||||||
t.Run(backend, func(t *testing.T) {
|
t.Run(backend, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
RunTestBackendServer_RoomUpdate(t)
|
RunTestBackendServer_RoomUpdate(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -831,8 +849,10 @@ func RunTestBackendServer_RoomUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomDelete(t *testing.T) {
|
func TestBackendServer_RoomDelete(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, backend := range eventBackendsForTest {
|
for _, backend := range eventBackendsForTest {
|
||||||
t.Run(backend, func(t *testing.T) {
|
t.Run(backend, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
RunTestBackendServer_RoomDelete(t)
|
RunTestBackendServer_RoomDelete(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -916,8 +936,10 @@ func RunTestBackendServer_RoomDelete(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_ParticipantsUpdatePermissions(t *testing.T) {
|
func TestBackendServer_ParticipantsUpdatePermissions(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -1047,6 +1069,8 @@ func TestBackendServer_ParticipantsUpdatePermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_ParticipantsUpdateEmptyPermissions(t *testing.T) {
|
func TestBackendServer_ParticipantsUpdateEmptyPermissions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1132,6 +1156,8 @@ func TestBackendServer_ParticipantsUpdateEmptyPermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
|
func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -1345,8 +1371,10 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_InCallAll(t *testing.T) {
|
func TestBackendServer_InCallAll(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -1595,6 +1623,8 @@ func TestBackendServer_InCallAll(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_RoomMessage(t *testing.T) {
|
func TestBackendServer_RoomMessage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1660,6 +1690,8 @@ func TestBackendServer_RoomMessage(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_TurnCredentials(t *testing.T) {
|
func TestBackendServer_TurnCredentials(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, _, _, server := CreateBackendServerForTestWithTurn(t)
|
_, _, _, _, _, server := CreateBackendServerForTestWithTurn(t)
|
||||||
|
|
||||||
q := make(url.Values)
|
q := make(url.Values)
|
||||||
|
@ -1703,6 +1735,7 @@ func TestBackendServer_TurnCredentials(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
config := goconf.NewConfigFile()
|
config := goconf.NewConfigFile()
|
||||||
config.AddOption("stats", "allowed_ips", "127.0.0.1, 192.168.0.1, 192.168.1.1/24")
|
config.AddOption("stats", "allowed_ips", "127.0.0.1, 192.168.0.1, 192.168.1.1/24")
|
||||||
_, backend, _, _, _, _ := CreateBackendServerForTestFromConfig(t, config)
|
_, backend, _, _, _, _ := CreateBackendServerForTestFromConfig(t, config)
|
||||||
|
@ -1720,7 +1753,9 @@ func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, addr := range allowed {
|
for _, addr := range allowed {
|
||||||
|
addr := addr
|
||||||
t.Run(addr, func(t *testing.T) {
|
t.Run(addr, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
r1 := &http.Request{
|
r1 := &http.Request{
|
||||||
RemoteAddr: addr,
|
RemoteAddr: addr,
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1796,9 @@ func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, addr := range notAllowed {
|
for _, addr := range notAllowed {
|
||||||
|
addr := addr
|
||||||
t.Run(addr, func(t *testing.T) {
|
t.Run(addr, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
r := &http.Request{
|
r := &http.Request{
|
||||||
RemoteAddr: addr,
|
RemoteAddr: addr,
|
||||||
}
|
}
|
||||||
|
@ -1773,6 +1810,7 @@ func TestBackendServer_StatsAllowedIps(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_IsNumeric(t *testing.T) {
|
func Test_IsNumeric(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
numeric := []string{
|
numeric := []string{
|
||||||
"0",
|
"0",
|
||||||
"1",
|
"1",
|
||||||
|
@ -1802,6 +1840,8 @@ func Test_IsNumeric(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_DialoutNoSipBridge(t *testing.T) {
|
func TestBackendServer_DialoutNoSipBridge(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1860,6 +1900,8 @@ func TestBackendServer_DialoutNoSipBridge(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_DialoutAccepted(t *testing.T) {
|
func TestBackendServer_DialoutAccepted(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1966,6 +2008,8 @@ func TestBackendServer_DialoutAccepted(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_DialoutAcceptedCompat(t *testing.T) {
|
func TestBackendServer_DialoutAcceptedCompat(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -2072,6 +2116,8 @@ func TestBackendServer_DialoutAcceptedCompat(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBackendServer_DialoutRejected(t *testing.T) {
|
func TestBackendServer_DialoutRejected(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
|
|
@ -52,6 +52,7 @@ func (tl *testListener) EtcdClientCreated(client *EtcdClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_BackendStorageEtcdNoLeak(t *testing.T) {
|
func Test_BackendStorageEtcdNoLeak(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
etcd, client := NewEtcdClientForTest(t)
|
etcd, client := NewEtcdClientForTest(t)
|
||||||
tl := &testListener{
|
tl := &testListener{
|
||||||
|
|
|
@ -28,6 +28,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBackoff_Exponential(t *testing.T) {
|
func TestBackoff_Exponential(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
backoff, err := NewExponentialBackoff(100*time.Millisecond, 500*time.Millisecond)
|
backoff, err := NewExponentialBackoff(100*time.Millisecond, 500*time.Millisecond)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -130,6 +130,8 @@ func SetCapabilitiesGetNow(t *testing.T, f func() time.Time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCapabilities(t *testing.T) {
|
func TestCapabilities(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
url, capabilities := NewCapabilitiesForTest(t)
|
url, capabilities := NewCapabilitiesForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -192,6 +194,8 @@ func TestCapabilities(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInvalidateCapabilities(t *testing.T) {
|
func TestInvalidateCapabilities(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
var called atomic.Uint32
|
var called atomic.Uint32
|
||||||
url, capabilities := NewCapabilitiesForTestWithCallback(t, func(cr *CapabilitiesResponse) {
|
url, capabilities := NewCapabilitiesForTestWithCallback(t, func(cr *CapabilitiesResponse) {
|
||||||
called.Add(1)
|
called.Add(1)
|
||||||
|
|
|
@ -117,6 +117,7 @@ func Test_permissionsEqual(t *testing.T) {
|
||||||
for idx, test := range tests {
|
for idx, test := range tests {
|
||||||
test := test
|
test := test
|
||||||
t.Run(strconv.Itoa(idx), func(t *testing.T) {
|
t.Run(strconv.Itoa(idx), func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
equal := permissionsEqual(test.a, test.b)
|
equal := permissionsEqual(test.a, test.b)
|
||||||
if equal != test.equal {
|
if equal != test.equal {
|
||||||
t.Errorf("Expected %+v to be %s to %+v but was %s", test.a, equalStrings[test.equal], test.b, equalStrings[equal])
|
t.Errorf("Expected %+v to be %s to %+v but was %s", test.a, equalStrings[test.equal], test.b, equalStrings[equal])
|
||||||
|
@ -126,6 +127,8 @@ func Test_permissionsEqual(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBandwidth_Client(t *testing.T) {
|
func TestBandwidth_Client(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -198,6 +201,8 @@ func TestBandwidth_Client(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBandwidth_Backend(t *testing.T) {
|
func TestBandwidth_Backend(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
||||||
|
|
||||||
u, err := url.Parse(server.URL + "/one")
|
u, err := url.Parse(server.URL + "/one")
|
||||||
|
|
|
@ -35,6 +35,7 @@ func TestDeferredExecutor_MultiClose(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeferredExecutor_QueueSize(t *testing.T) {
|
func TestDeferredExecutor_QueueSize(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
e := NewDeferredExecutor(0)
|
e := NewDeferredExecutor(0)
|
||||||
defer e.waitForStop()
|
defer e.waitForStop()
|
||||||
defer e.Close()
|
defer e.Close()
|
||||||
|
@ -100,6 +101,7 @@ func TestDeferredExecutor_CloseFromFunc(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeferredExecutor_DeferAfterClose(t *testing.T) {
|
func TestDeferredExecutor_DeferAfterClose(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
e := NewDeferredExecutor(64)
|
e := NewDeferredExecutor(64)
|
||||||
defer e.waitForStop()
|
defer e.waitForStop()
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,8 @@ func DeleteEtcdValue(etcd *embed.Etcd, key string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_EtcdClient_Get(t *testing.T) {
|
func Test_EtcdClient_Get(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd, client := NewEtcdClientForTest(t)
|
etcd, client := NewEtcdClientForTest(t)
|
||||||
|
|
||||||
if response, err := client.Get(context.Background(), "foo"); err != nil {
|
if response, err := client.Get(context.Background(), "foo"); err != nil {
|
||||||
|
@ -165,6 +167,8 @@ func Test_EtcdClient_Get(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_EtcdClient_GetPrefix(t *testing.T) {
|
func Test_EtcdClient_GetPrefix(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd, client := NewEtcdClientForTest(t)
|
etcd, client := NewEtcdClientForTest(t)
|
||||||
|
|
||||||
if response, err := client.Get(context.Background(), "foo"); err != nil {
|
if response, err := client.Get(context.Background(), "foo"); err != nil {
|
||||||
|
@ -286,6 +290,8 @@ func (l *EtcdClientTestListener) EtcdKeyDeleted(client *EtcdClient, key string,
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_EtcdClient_Watch(t *testing.T) {
|
func Test_EtcdClient_Watch(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd, client := NewEtcdClientForTest(t)
|
etcd, client := NewEtcdClientForTest(t)
|
||||||
|
|
||||||
SetEtcdValue(etcd, "foo/a", []byte("1"))
|
SetEtcdValue(etcd, "foo/a", []byte("1"))
|
||||||
|
|
|
@ -97,6 +97,7 @@ func runConcurrentFlags(t *testing.T, count int, f func()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFlagsConcurrentAdd(t *testing.T) {
|
func TestFlagsConcurrentAdd(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var flags Flags
|
var flags Flags
|
||||||
|
|
||||||
var added atomic.Int32
|
var added atomic.Int32
|
||||||
|
@ -111,6 +112,7 @@ func TestFlagsConcurrentAdd(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFlagsConcurrentRemove(t *testing.T) {
|
func TestFlagsConcurrentRemove(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var flags Flags
|
var flags Flags
|
||||||
flags.Set(1)
|
flags.Set(1)
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ func TestFlagsConcurrentRemove(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFlagsConcurrentSet(t *testing.T) {
|
func TestFlagsConcurrentSet(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var flags Flags
|
var flags Flags
|
||||||
|
|
||||||
var set atomic.Int32
|
var set atomic.Int32
|
||||||
|
|
|
@ -112,6 +112,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) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
_, addr1 := NewGrpcServerForTest(t)
|
_, addr1 := NewGrpcServerForTest(t)
|
||||||
_, addr2 := NewGrpcServerForTest(t)
|
_, addr2 := NewGrpcServerForTest(t)
|
||||||
|
@ -135,6 +136,8 @@ func Test_GrpcClients_EtcdInitial(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_EtcdUpdate(t *testing.T) {
|
func Test_GrpcClients_EtcdUpdate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd := NewEtcdForTest(t)
|
etcd := NewEtcdForTest(t)
|
||||||
client, _ := NewGrpcClientsWithEtcdForTest(t, etcd)
|
client, _ := NewGrpcClientsWithEtcdForTest(t, etcd)
|
||||||
ch := client.getWakeupChannelForTesting()
|
ch := client.getWakeupChannelForTesting()
|
||||||
|
@ -189,6 +192,8 @@ func Test_GrpcClients_EtcdUpdate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_EtcdIgnoreSelf(t *testing.T) {
|
func Test_GrpcClients_EtcdIgnoreSelf(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
etcd := NewEtcdForTest(t)
|
etcd := NewEtcdForTest(t)
|
||||||
client, _ := NewGrpcClientsWithEtcdForTest(t, etcd)
|
client, _ := NewGrpcClientsWithEtcdForTest(t, etcd)
|
||||||
ch := client.getWakeupChannelForTesting()
|
ch := client.getWakeupChannelForTesting()
|
||||||
|
@ -233,6 +238,7 @@ func Test_GrpcClients_EtcdIgnoreSelf(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
lookup := newMockDnsLookupForTest(t)
|
lookup := newMockDnsLookupForTest(t)
|
||||||
target := "testgrpc:12345"
|
target := "testgrpc:12345"
|
||||||
|
@ -289,6 +295,8 @@ func Test_GrpcClients_DnsDiscovery(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
lookup := newMockDnsLookupForTest(t)
|
lookup := newMockDnsLookupForTest(t)
|
||||||
target := "testgrpc:12345"
|
target := "testgrpc:12345"
|
||||||
ip1 := net.ParseIP("192.168.0.1")
|
ip1 := net.ParseIP("192.168.0.1")
|
||||||
|
@ -324,6 +332,7 @@ func Test_GrpcClients_DnsDiscoveryInitialFailed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcClients_Encryption(t *testing.T) {
|
func Test_GrpcClients_Encryption(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -98,6 +98,8 @@ func NewGrpcServerForTest(t *testing.T) (server *GrpcServer, addr string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcServer_ReloadCerts(t *testing.T) {
|
func Test_GrpcServer_ReloadCerts(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
key, err := rsa.GenerateKey(rand.Reader, 1024)
|
key, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -178,6 +180,8 @@ func Test_GrpcServer_ReloadCerts(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_GrpcServer_ReloadCA(t *testing.T) {
|
func Test_GrpcServer_ReloadCA(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
serverKey, err := rsa.GenerateKey(rand.Reader, 1024)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -29,6 +29,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHttpClientPool(t *testing.T) {
|
func TestHttpClientPool(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
if _, err := NewHttpClientPool(0, false); err == nil {
|
if _, err := NewHttpClientPool(0, false); err == nil {
|
||||||
t.Error("should not be possible to create empty pool")
|
t.Error("should not be possible to create empty pool")
|
||||||
}
|
}
|
||||||
|
|
119
hub_test.go
119
hub_test.go
|
@ -794,6 +794,8 @@ func performHousekeeping(hub *Hub, now time.Time) *sync.WaitGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInitialWelcome(t *testing.T) {
|
func TestInitialWelcome(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -817,6 +819,8 @@ func TestInitialWelcome(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpectClientHello(t *testing.T) {
|
func TestExpectClientHello(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
// The server will send an error and close the connection if no "Hello"
|
// The server will send an error and close the connection if no "Hello"
|
||||||
|
@ -851,6 +855,8 @@ func TestExpectClientHello(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpectClientHelloUnsupportedVersion(t *testing.T) {
|
func TestExpectClientHelloUnsupportedVersion(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -879,6 +885,8 @@ func TestExpectClientHelloUnsupportedVersion(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV1(t *testing.T) {
|
func TestClientHelloV1(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -904,6 +912,7 @@ func TestClientHelloV1(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2(t *testing.T) {
|
func TestClientHelloV2(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -954,6 +963,7 @@ func TestClientHelloV2(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2_IssuedInFuture(t *testing.T) {
|
func TestClientHelloV2_IssuedInFuture(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -985,6 +995,7 @@ func TestClientHelloV2_IssuedInFuture(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2_Expired(t *testing.T) {
|
func TestClientHelloV2_Expired(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -1015,6 +1026,7 @@ func TestClientHelloV2_Expired(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2_IssuedAtMissing(t *testing.T) {
|
func TestClientHelloV2_IssuedAtMissing(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -1046,6 +1058,7 @@ func TestClientHelloV2_IssuedAtMissing(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2_ExpiresAtMissing(t *testing.T) {
|
func TestClientHelloV2_ExpiresAtMissing(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -1077,6 +1090,7 @@ func TestClientHelloV2_ExpiresAtMissing(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloV2_CachedCapabilities(t *testing.T) {
|
func TestClientHelloV2_CachedCapabilities(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, algo := range testHelloV2Algorithms {
|
for _, algo := range testHelloV2Algorithms {
|
||||||
t.Run(algo, func(t *testing.T) {
|
t.Run(algo, func(t *testing.T) {
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
@ -1130,6 +1144,8 @@ func TestClientHelloV2_CachedCapabilities(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloWithSpaces(t *testing.T) {
|
func TestClientHelloWithSpaces(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1156,6 +1172,8 @@ func TestClientHelloWithSpaces(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloAllowAll(t *testing.T) {
|
func TestClientHelloAllowAll(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTestWithConfig(t, func(server *httptest.Server) (*goconf.ConfigFile, error) {
|
hub, _, _, server := CreateHubForTestWithConfig(t, func(server *httptest.Server) (*goconf.ConfigFile, error) {
|
||||||
config, err := getTestConfig(server)
|
config, err := getTestConfig(server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1190,8 +1208,10 @@ func TestClientHelloAllowAll(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloSessionLimit(t *testing.T) {
|
func TestClientHelloSessionLimit(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -1352,6 +1372,8 @@ func TestClientHelloSessionLimit(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSessionIdsUnordered(t *testing.T) {
|
func TestSessionIdsUnordered(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
publicSessionIds := make([]string, 0)
|
publicSessionIds := make([]string, 0)
|
||||||
|
@ -1425,6 +1447,8 @@ func TestSessionIdsUnordered(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResume(t *testing.T) {
|
func TestClientHelloResume(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1480,6 +1504,8 @@ func TestClientHelloResume(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeExpired(t *testing.T) {
|
func TestClientHelloResumeExpired(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1535,6 +1561,8 @@ func TestClientHelloResumeExpired(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeTakeover(t *testing.T) {
|
func TestClientHelloResumeTakeover(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -1603,6 +1631,8 @@ func TestClientHelloResumeTakeover(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeOtherHub(t *testing.T) {
|
func TestClientHelloResumeOtherHub(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1697,6 +1727,8 @@ func TestClientHelloResumeOtherHub(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumePublicId(t *testing.T) {
|
func TestClientHelloResumePublicId(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
// Test that a client can't resume a "public" session of another user.
|
// Test that a client can't resume a "public" session of another user.
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
|
@ -1771,6 +1803,8 @@ func TestClientHelloResumePublicId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloByeResume(t *testing.T) {
|
func TestClientHelloByeResume(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1836,6 +1870,8 @@ func TestClientHelloByeResume(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeAndJoin(t *testing.T) {
|
func TestClientHelloResumeAndJoin(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -1937,6 +1973,7 @@ func runGrpcProxyTest(t *testing.T, f func(hub1, hub2 *Hub, server1, server2 *ht
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeProxy(t *testing.T) {
|
func TestClientHelloResumeProxy(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
||||||
client1 := NewTestClient(t, server1, hub1)
|
client1 := NewTestClient(t, server1, hub1)
|
||||||
|
@ -2029,6 +2066,7 @@ func TestClientHelloResumeProxy(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeProxy_Takeover(t *testing.T) {
|
func TestClientHelloResumeProxy_Takeover(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
||||||
client1 := NewTestClient(t, server1, hub1)
|
client1 := NewTestClient(t, server1, hub1)
|
||||||
|
@ -2136,6 +2174,7 @@ func TestClientHelloResumeProxy_Takeover(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloResumeProxy_Disconnect(t *testing.T) {
|
func TestClientHelloResumeProxy_Disconnect(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
runGrpcProxyTest(t, func(hub1, hub2 *Hub, server1, server2 *httptest.Server) {
|
||||||
client1 := NewTestClient(t, server1, hub1)
|
client1 := NewTestClient(t, server1, hub1)
|
||||||
|
@ -2200,6 +2239,8 @@ func TestClientHelloResumeProxy_Disconnect(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloClient(t *testing.T) {
|
func TestClientHelloClient(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -2228,6 +2269,8 @@ func TestClientHelloClient(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloClient_V3Api(t *testing.T) {
|
func TestClientHelloClient_V3Api(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -2261,6 +2304,8 @@ func TestClientHelloClient_V3Api(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientHelloInternal(t *testing.T) {
|
func TestClientHelloInternal(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -2289,8 +2334,10 @@ func TestClientHelloInternal(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessageToSessionId(t *testing.T) {
|
func TestClientMessageToSessionId(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -2362,8 +2409,10 @@ func TestClientMessageToSessionId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientControlToSessionId(t *testing.T) {
|
func TestClientControlToSessionId(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -2435,6 +2484,8 @@ func TestClientControlToSessionId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientControlMissingPermissions(t *testing.T) {
|
func TestClientControlMissingPermissions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -2519,6 +2570,8 @@ func TestClientControlMissingPermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessageToUserId(t *testing.T) {
|
func TestClientMessageToUserId(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -2579,6 +2632,8 @@ func TestClientMessageToUserId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientControlToUserId(t *testing.T) {
|
func TestClientControlToUserId(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -2639,6 +2694,8 @@ func TestClientControlToUserId(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessageToUserIdMultipleSessions(t *testing.T) {
|
func TestClientMessageToUserIdMultipleSessions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -2722,8 +2779,10 @@ func WaitForUsersJoined(ctx context.Context, t *testing.T, client1 *TestClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessageToRoom(t *testing.T) {
|
func TestClientMessageToRoom(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -2812,8 +2871,10 @@ func TestClientMessageToRoom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientControlToRoom(t *testing.T) {
|
func TestClientControlToRoom(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -2902,6 +2963,8 @@ func TestClientControlToRoom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinRoom(t *testing.T) {
|
func TestJoinRoom(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -2941,6 +3004,8 @@ func TestJoinRoom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinRoomTwice(t *testing.T) {
|
func TestJoinRoomTwice(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -3018,6 +3083,8 @@ func TestJoinRoomTwice(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpectAnonymousJoinRoom(t *testing.T) {
|
func TestExpectAnonymousJoinRoom(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -3070,6 +3137,8 @@ func TestExpectAnonymousJoinRoom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExpectAnonymousJoinRoomAfterLeave(t *testing.T) {
|
func TestExpectAnonymousJoinRoomAfterLeave(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -3156,6 +3225,8 @@ func TestExpectAnonymousJoinRoomAfterLeave(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinRoomChange(t *testing.T) {
|
func TestJoinRoomChange(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -3208,6 +3279,8 @@ func TestJoinRoomChange(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinMultiple(t *testing.T) {
|
func TestJoinMultiple(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -3286,6 +3359,8 @@ func TestJoinMultiple(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinDisplaynamesPermission(t *testing.T) {
|
func TestJoinDisplaynamesPermission(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -3368,6 +3443,8 @@ func TestJoinDisplaynamesPermission(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInitialRoomPermissions(t *testing.T) {
|
func TestInitialRoomPermissions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -3411,6 +3488,8 @@ func TestInitialRoomPermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJoinRoomSwitchClient(t *testing.T) {
|
func TestJoinRoomSwitchClient(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client := NewTestClient(t, server, hub)
|
client := NewTestClient(t, server, hub)
|
||||||
|
@ -3536,6 +3615,8 @@ func TestGetRealUserIP(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientMessageToSessionIdWhileDisconnected(t *testing.T) {
|
func TestClientMessageToSessionIdWhileDisconnected(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -3627,6 +3708,8 @@ func TestClientMessageToSessionIdWhileDisconnected(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) {
|
func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
client1 := NewTestClient(t, server, hub)
|
client1 := NewTestClient(t, server, hub)
|
||||||
|
@ -3759,8 +3842,10 @@ func TestRoomParticipantsListUpdateWhileDisconnected(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientTakeoverRoomSession(t *testing.T) {
|
func TestClientTakeoverRoomSession(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
RunTestClientTakeoverRoomSession(t)
|
RunTestClientTakeoverRoomSession(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -3902,6 +3987,8 @@ func RunTestClientTakeoverRoomSession(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientSendOfferPermissions(t *testing.T) {
|
func TestClientSendOfferPermissions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -4041,6 +4128,8 @@ func TestClientSendOfferPermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientSendOfferPermissionsAudioOnly(t *testing.T) {
|
func TestClientSendOfferPermissionsAudioOnly(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -4132,6 +4221,8 @@ func TestClientSendOfferPermissionsAudioOnly(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientSendOfferPermissionsAudioVideo(t *testing.T) {
|
func TestClientSendOfferPermissionsAudioVideo(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -4259,6 +4350,8 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientSendOfferPermissionsAudioVideoMedia(t *testing.T) {
|
func TestClientSendOfferPermissionsAudioVideoMedia(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -4391,8 +4484,10 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientRequestOfferNotInRoom(t *testing.T) {
|
func TestClientRequestOfferNotInRoom(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -4607,6 +4702,8 @@ func TestClientRequestOfferNotInRoom(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNoSendBetweenSessionsOnDifferentBackends(t *testing.T) {
|
func TestNoSendBetweenSessionsOnDifferentBackends(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
// Clients can't send messages to sessions connected from other backends.
|
// Clients can't send messages to sessions connected from other backends.
|
||||||
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
||||||
|
|
||||||
|
@ -4678,6 +4775,8 @@ func TestNoSendBetweenSessionsOnDifferentBackends(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNoSameRoomOnDifferentBackends(t *testing.T) {
|
func TestNoSameRoomOnDifferentBackends(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
hub, _, _, server := CreateHubWithMultipleBackendsForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -4787,8 +4886,10 @@ func TestNoSameRoomOnDifferentBackends(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientSendOffer(t *testing.T) {
|
func TestClientSendOffer(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -4906,6 +5007,8 @@ func TestClientSendOffer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientUnshareScreen(t *testing.T) {
|
func TestClientUnshareScreen(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
mcu, err := NewTestMCU()
|
mcu, err := NewTestMCU()
|
||||||
|
@ -5000,8 +5103,10 @@ func TestClientUnshareScreen(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVirtualClientSessions(t *testing.T) {
|
func TestVirtualClientSessions(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -5337,8 +5442,10 @@ func TestVirtualClientSessions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func DoTestSwitchToOne(t *testing.T, details map[string]interface{}) {
|
func DoTestSwitchToOne(t *testing.T, details map[string]interface{}) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -5474,8 +5581,10 @@ func TestSwitchToOneList(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func DoTestSwitchToMultiple(t *testing.T, details1 map[string]interface{}, details2 map[string]interface{}) {
|
func DoTestSwitchToMultiple(t *testing.T, details1 map[string]interface{}, details2 map[string]interface{}) {
|
||||||
|
CatchLogForTest(t)
|
||||||
for _, subtest := range clusteredTests {
|
for _, subtest := range clusteredTests {
|
||||||
t.Run(subtest, func(t *testing.T) {
|
t.Run(subtest, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var hub1 *Hub
|
var hub1 *Hub
|
||||||
var hub2 *Hub
|
var hub2 *Hub
|
||||||
var server1 *httptest.Server
|
var server1 *httptest.Server
|
||||||
|
@ -5620,6 +5729,8 @@ func TestSwitchToMultipleMixed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGeoipOverrides(t *testing.T) {
|
func TestGeoipOverrides(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
country1 := "DE"
|
country1 := "DE"
|
||||||
country2 := "IT"
|
country2 := "IT"
|
||||||
country3 := "site1"
|
country3 := "site1"
|
||||||
|
@ -5657,6 +5768,8 @@ func TestGeoipOverrides(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDialoutStatus(t *testing.T) {
|
func TestDialoutStatus(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
_, _, _, hub, _, server := CreateBackendServerForTest(t)
|
||||||
|
|
||||||
internalClient := NewTestClient(t, server, hub)
|
internalClient := NewTestClient(t, server, hub)
|
||||||
|
@ -5868,6 +5981,8 @@ func TestDialoutStatus(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGracefulShutdownInitial(t *testing.T) {
|
func TestGracefulShutdownInitial(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, _ := CreateHubForTest(t)
|
hub, _, _, _ := CreateHubForTest(t)
|
||||||
|
|
||||||
hub.ScheduleShutdown()
|
hub.ScheduleShutdown()
|
||||||
|
@ -5875,6 +5990,8 @@ func TestGracefulShutdownInitial(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGracefulShutdownOnBye(t *testing.T) {
|
func TestGracefulShutdownOnBye(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -5908,6 +6025,8 @@ func TestGracefulShutdownOnBye(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGracefulShutdownOnExpiration(t *testing.T) {
|
func TestGracefulShutdownOnExpiration(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
|
|
@ -104,6 +104,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNatsClient_Subscribe(t *testing.T) {
|
func TestNatsClient_Subscribe(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
client := CreateLocalNatsClientForTest(t)
|
client := CreateLocalNatsClientForTest(t)
|
||||||
|
|
||||||
|
@ -120,6 +121,7 @@ func testNatsClient_PublishAfterClose(t *testing.T, client NatsClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNatsClient_PublishAfterClose(t *testing.T) {
|
func TestNatsClient_PublishAfterClose(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
client := CreateLocalNatsClientForTest(t)
|
client := CreateLocalNatsClientForTest(t)
|
||||||
|
|
||||||
|
@ -137,6 +139,7 @@ func testNatsClient_SubscribeAfterClose(t *testing.T, client NatsClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNatsClient_SubscribeAfterClose(t *testing.T) {
|
func TestNatsClient_SubscribeAfterClose(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
client := CreateLocalNatsClientForTest(t)
|
client := CreateLocalNatsClientForTest(t)
|
||||||
|
|
||||||
|
@ -159,6 +162,7 @@ func testNatsClient_BadSubjects(t *testing.T, client NatsClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNatsClient_BadSubjects(t *testing.T) {
|
func TestNatsClient_BadSubjects(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
ensureNoGoroutinesLeak(t, func(t *testing.T) {
|
||||||
client := CreateLocalNatsClientForTest(t)
|
client := CreateLocalNatsClientForTest(t)
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ func TestNotifierResetWillNotify(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNotifierDuplicate(t *testing.T) {
|
func TestNotifierDuplicate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var notifier Notifier
|
var notifier Notifier
|
||||||
var wgStart sync.WaitGroup
|
var wgStart sync.WaitGroup
|
||||||
var wgEnd sync.WaitGroup
|
var wgEnd sync.WaitGroup
|
||||||
|
|
|
@ -93,6 +93,7 @@ func newProxyServerForTest(t *testing.T) (*ProxyServer, *rsa.PrivateKey) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTokenInFuture(t *testing.T) {
|
func TestTokenInFuture(t *testing.T) {
|
||||||
|
signaling.CatchLogForTest(t)
|
||||||
server, key := newProxyServerForTest(t)
|
server, key := newProxyServerForTest(t)
|
||||||
|
|
||||||
claims := &signaling.TokenClaims{
|
claims := &signaling.TokenClaims{
|
||||||
|
|
|
@ -39,6 +39,8 @@ import (
|
||||||
"github.com/dlintw/goconf"
|
"github.com/dlintw/goconf"
|
||||||
"go.etcd.io/etcd/server/v3/embed"
|
"go.etcd.io/etcd/server/v3/embed"
|
||||||
"go.etcd.io/etcd/server/v3/lease"
|
"go.etcd.io/etcd/server/v3/lease"
|
||||||
|
|
||||||
|
signaling "github.com/strukturag/nextcloud-spreed-signaling"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -160,6 +162,7 @@ func generateAndSaveKey(t *testing.T, etcd *embed.Etcd, name string) *rsa.Privat
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProxyTokensEtcd(t *testing.T) {
|
func TestProxyTokensEtcd(t *testing.T) {
|
||||||
|
signaling.CatchLogForTest(t)
|
||||||
tokens, etcd := newTokensEtcdForTesting(t)
|
tokens, etcd := newTokensEtcdForTesting(t)
|
||||||
|
|
||||||
key1 := generateAndSaveKey(t, etcd, "/foo")
|
key1 := generateAndSaveKey(t, etcd, "/foo")
|
||||||
|
|
|
@ -62,6 +62,8 @@ func SetEtcdProxy(t *testing.T, etcd *embed.Etcd, path string, proxy *TestProxyI
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProxyConfigEtcd(t *testing.T) {
|
func TestProxyConfigEtcd(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
proxy := newMcuProxyForConfig(t)
|
proxy := newMcuProxyForConfig(t)
|
||||||
etcd, config := newProxyConfigEtcd(t, proxy)
|
etcd, config := newProxyConfigEtcd(t, proxy)
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ func updateProxyConfigStatic(t *testing.T, config ProxyConfig, dns bool, urls ..
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProxyConfigStaticSimple(t *testing.T) {
|
func TestProxyConfigStaticSimple(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
proxy := newMcuProxyForConfig(t)
|
proxy := newMcuProxyForConfig(t)
|
||||||
config, _ := newProxyConfigStatic(t, proxy, false, "https://foo/")
|
config, _ := newProxyConfigStatic(t, proxy, false, "https://foo/")
|
||||||
proxy.Expect("add", "https://foo/")
|
proxy.Expect("add", "https://foo/")
|
||||||
|
@ -77,6 +78,7 @@ func TestProxyConfigStaticSimple(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProxyConfigStaticDNS(t *testing.T) {
|
func TestProxyConfigStaticDNS(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
lookup := newMockDnsLookupForTest(t)
|
lookup := newMockDnsLookupForTest(t)
|
||||||
proxy := newMcuProxyForConfig(t)
|
proxy := newMcuProxyForConfig(t)
|
||||||
config, dnsMonitor := newProxyConfigStatic(t, proxy, true, "https://foo/")
|
config, dnsMonitor := newProxyConfigStatic(t, proxy, true, "https://foo/")
|
||||||
|
|
|
@ -63,6 +63,7 @@ func NewRoomPingForTest(t *testing.T) (*url.URL, *RoomPing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSingleRoomPing(t *testing.T) {
|
func TestSingleRoomPing(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
u, ping := NewRoomPingForTest(t)
|
u, ping := NewRoomPingForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -113,6 +114,7 @@ func TestSingleRoomPing(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMultiRoomPing(t *testing.T) {
|
func TestMultiRoomPing(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
u, ping := NewRoomPingForTest(t)
|
u, ping := NewRoomPingForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -159,6 +161,7 @@ func TestMultiRoomPing(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMultiRoomPing_Separate(t *testing.T) {
|
func TestMultiRoomPing_Separate(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
u, ping := NewRoomPingForTest(t)
|
u, ping := NewRoomPingForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
@ -201,6 +204,7 @@ func TestMultiRoomPing_Separate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMultiRoomPing_DeleteRoom(t *testing.T) {
|
func TestMultiRoomPing_DeleteRoom(t *testing.T) {
|
||||||
|
CatchLogForTest(t)
|
||||||
u, ping := NewRoomPingForTest(t)
|
u, ping := NewRoomPingForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
|
|
@ -73,6 +73,8 @@ func TestRoom_InCall(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoom_Update(t *testing.T) {
|
func TestRoom_Update(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, router, server := CreateHubForTest(t)
|
hub, _, router, server := CreateHubForTest(t)
|
||||||
|
|
||||||
config, err := getTestConfig(server)
|
config, err := getTestConfig(server)
|
||||||
|
@ -210,6 +212,8 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoom_Delete(t *testing.T) {
|
func TestRoom_Delete(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, router, server := CreateHubForTest(t)
|
hub, _, router, server := CreateHubForTest(t)
|
||||||
|
|
||||||
config, err := getTestConfig(server)
|
config, err := getTestConfig(server)
|
||||||
|
@ -352,6 +356,8 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoom_RoomSessionData(t *testing.T) {
|
func TestRoom_RoomSessionData(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, router, server := CreateHubForTest(t)
|
hub, _, router, server := CreateHubForTest(t)
|
||||||
|
|
||||||
config, err := getTestConfig(server)
|
config, err := getTestConfig(server)
|
||||||
|
@ -421,6 +427,8 @@ func TestRoom_RoomSessionData(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoom_InCallAll(t *testing.T) {
|
func TestRoom_InCallAll(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, router, server := CreateHubForTest(t)
|
hub, _, router, server := CreateHubForTest(t)
|
||||||
|
|
||||||
config, err := getTestConfig(server)
|
config, err := getTestConfig(server)
|
||||||
|
|
|
@ -118,6 +118,7 @@ func TestSingleNotifierResetWillNotify(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSingleNotifierDuplicate(t *testing.T) {
|
func TestSingleNotifierDuplicate(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var notifier SingleNotifier
|
var notifier SingleNotifier
|
||||||
var wgStart sync.WaitGroup
|
var wgStart sync.WaitGroup
|
||||||
var wgEnd sync.WaitGroup
|
var wgEnd sync.WaitGroup
|
||||||
|
|
49
test_helpers.go
Normal file
49
test_helpers.go
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* Standalone signaling server for the Nextcloud Spreed app.
|
||||||
|
* Copyright (C) 2024 struktur AG
|
||||||
|
*
|
||||||
|
* @author Joachim Bauch <bauch@struktur.de>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package signaling
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type testLogWriter struct {
|
||||||
|
t testing.TB
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *testLogWriter) Write(b []byte) (int, error) {
|
||||||
|
w.t.Helper()
|
||||||
|
w.t.Logf("%s", string(b))
|
||||||
|
return len(b), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CatchLogForTest(t testing.TB) {
|
||||||
|
prevWriter := log.Writer()
|
||||||
|
prevFlags := log.Flags()
|
||||||
|
t.Cleanup(func() {
|
||||||
|
log.SetOutput(prevWriter)
|
||||||
|
log.SetFlags(prevFlags)
|
||||||
|
})
|
||||||
|
|
||||||
|
log.SetOutput(&testLogWriter{t})
|
||||||
|
log.SetFlags(prevFlags | log.Lshortfile)
|
||||||
|
}
|
|
@ -133,6 +133,8 @@ func Test_TransientData(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_TransientMessages(t *testing.T) {
|
func Test_TransientMessages(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||||
|
|
|
@ -30,6 +30,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestVirtualSession(t *testing.T) {
|
func TestVirtualSession(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -338,6 +340,8 @@ func checkHasEntryWithInCall(message *RoomEventServerMessage, sessionId string,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVirtualSessionCustomInCall(t *testing.T) {
|
func TestVirtualSessionCustomInCall(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
@ -569,6 +573,8 @@ func TestVirtualSessionCustomInCall(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVirtualSessionCleanup(t *testing.T) {
|
func TestVirtualSessionCleanup(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
CatchLogForTest(t)
|
||||||
hub, _, _, server := CreateHubForTest(t)
|
hub, _, _, server := CreateHubForTest(t)
|
||||||
|
|
||||||
roomId := "the-room-id"
|
roomId := "the-room-id"
|
||||||
|
|
Loading…
Reference in a new issue