fix race condition in TestMetrics (#1830)

This commit is contained in:
Alessandro Ros 2023-05-18 20:05:35 +02:00 committed by GitHub
parent 330a9e027c
commit 13fb559f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"net/url" "net/url"
"os" "os"
"testing" "testing"
"time"
"github.com/bluenviron/gortsplib/v3" "github.com/bluenviron/gortsplib/v3"
"github.com/bluenviron/gortsplib/v3/pkg/formats" "github.com/bluenviron/gortsplib/v3/pkg/formats"
@ -103,6 +104,8 @@ webrtc_sessions_bytes_sent 0
err = conn.WriteTracks(videoTrack, nil) err = conn.WriteTracks(videoTrack, nil)
require.NoError(t, err) require.NoError(t, err)
time.Sleep(500 * time.Millisecond)
bo = httpPullFile(t, hc, "http://localhost:9998/metrics") bo = httpPullFile(t, hc, "http://localhost:9998/metrics")
require.Regexp(t, require.Regexp(t,