Improve readability of test failures (#386)

This commit is contained in:
David Zhao
2022-01-28 21:34:21 -08:00
committed by GitHub
parent 5b57522c05
commit 6af6eefb8c
9 changed files with 198 additions and 147 deletions
+10 -8
View File
@@ -39,19 +39,17 @@ func TestMultiNodeRouting(t *testing.T) {
defer t1.Stop()
}
testutils.WithTimeout(t, "c2 should receive one track", func() bool {
testutils.WithTimeout(t, func() string {
if len(c2.SubscribedTracks()) == 0 {
return false
return "c2 received no tracks"
}
// should have received two tracks
if len(c2.SubscribedTracks()[c1.ID()]) != 1 {
return false
return "c2 didn't receive track published by c1"
}
tr1 := c2.SubscribedTracks()[c1.ID()][0]
streamID, _ := rtc.UnpackStreamID(tr1.StreamID())
require.Equal(t, c1.ID(), streamID)
return true
return ""
})
remoteC1 := c2.GetRemoteParticipant(c1.ID())
@@ -176,8 +174,12 @@ func TestMultiNodeRefreshToken(t *testing.T) {
})
require.NoError(t, err)
testutils.WithTimeout(t, "waiting for refresh token", func() bool {
return c1.RefreshToken() != ""
testutils.WithTimeout(t, func() string {
if c1.RefreshToken() != "" {
return ""
} else {
return "did not receive refresh token"
}
})
// parse token to ensure it's correct