diff --git a/src/signaling/backend_server_test.go b/src/signaling/backend_server_test.go index c800906..3403573 100644 --- a/src/signaling/backend_server_test.go +++ b/src/signaling/backend_server_test.go @@ -1068,11 +1068,13 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) { data, err := json.Marshal(msg) if err != nil { - t.Fatal(err) + t.Error(err) + return } res, err := performBackendRequest(server.URL+"/api/v1/room/"+roomId, data) if err != nil { - t.Fatal(err) + t.Error(err) + return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) @@ -1119,11 +1121,13 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) { data, err := json.Marshal(msg) if err != nil { - t.Fatal(err) + t.Error(err) + return } res, err := performBackendRequest(server.URL+"/api/v1/room/"+roomId, data) if err != nil { - t.Fatal(err) + t.Error(err) + return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) @@ -1136,6 +1140,9 @@ func TestBackendServer_ParticipantsUpdateTimeout(t *testing.T) { }() wg.Wait() + if t.Failed() { + return + } msg1_a, err := client1.RunUntilMessage(ctx) if err != nil { diff --git a/src/signaling/natsclient_loopback_test.go b/src/signaling/natsclient_loopback_test.go index 95bc2bd..680efed 100644 --- a/src/signaling/natsclient_loopback_test.go +++ b/src/signaling/natsclient_loopback_test.go @@ -88,7 +88,8 @@ func TestLoopbackNatsClient_Subscribe(t *testing.T) { if total == max { err := sub.Unsubscribe() if err != nil { - t.Fatal("Unsubscribe failed with err:", err) + t.Errorf("Unsubscribe failed with err: %s", err) + return } ch <- true } @@ -135,10 +136,12 @@ func TestLoopbackNatsClient_Request(t *testing.T) { go func() { msg := <-dest if err := client.Publish(msg.Reply, []byte("world")); err != nil { - t.Fatal(err) + t.Error(err) + return } if err := sub.Unsubscribe(); err != nil { - t.Fatal("Unsubscribe failed with err:", err) + t.Error("Unsubscribe failed with err:", err) + return } }() reply, err := client.Request("foo", []byte("hello"), 1*time.Second) @@ -182,10 +185,12 @@ func TestLoopbackNatsClient_RequestTimeout(t *testing.T) { msg := <-dest time.Sleep(200 * time.Millisecond) if err := client.Publish(msg.Reply, []byte("world")); err != nil { - t.Fatal(err) + t.Error(err) + return } if err := sub.Unsubscribe(); err != nil { - t.Fatal("Unsubscribe failed with err:", err) + t.Error("Unsubscribe failed with err:", err) + return } }() reply, err := client.Request("foo", []byte("hello"), 100*time.Millisecond) diff --git a/src/signaling/testclient_test.go b/src/signaling/testclient_test.go index 99393d9..4ae5681 100644 --- a/src/signaling/testclient_test.go +++ b/src/signaling/testclient_test.go @@ -233,7 +233,8 @@ func NewTestClient(t *testing.T, server *httptest.Server, hub *Hub) *TestClient readErrorChan <- err return } else if messageType != websocket.TextMessage { - t.Fatalf("Expect text message, got %d", messageType) + t.Errorf("Expect text message, got %d", messageType) + return } messageChan <- data