tests: fix race condition in tests (#1629)

This commit is contained in:
Alessandro Ros 2023-03-31 11:43:57 +02:00 committed by GitHub
parent 9beb22c4f2
commit c9dea38e27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 17 deletions

View File

@ -279,7 +279,6 @@ func TestRTSPServerPublisherOverride(t *testing.T) {
} { } {
t.Run(ca, func(t *testing.T) { t.Run(ca, func(t *testing.T) {
conf := "rtmpDisable: yes\n" + conf := "rtmpDisable: yes\n" +
"protocols: [tcp]\n" +
"paths:\n" + "paths:\n" +
" all:\n" " all:\n"
@ -338,24 +337,10 @@ func TestRTSPServerPublisherOverride(t *testing.T) {
_, err = c.Play(nil) _, err = c.Play(nil)
require.NoError(t, err) require.NoError(t, err)
err = s1.WritePacketRTP(medi, &rtp.Packet{
Header: rtp.Header{
Version: 0x02,
PayloadType: 96,
SequenceNumber: 57899,
Timestamp: 345234345,
SSRC: 978651231,
Marker: true,
},
Payload: []byte{0x01, 0x02, 0x03, 0x04},
})
if ca == "enabled" { if ca == "enabled" {
require.Error(t, err) err := s1.Wait()
} else { require.EqualError(t, err, "EOF")
require.NoError(t, err)
}
if ca == "enabled" {
err = s2.WritePacketRTP(medi, &rtp.Packet{ err = s2.WritePacketRTP(medi, &rtp.Packet{
Header: rtp.Header{ Header: rtp.Header{
Version: 0x02, Version: 0x02,
@ -368,6 +353,19 @@ func TestRTSPServerPublisherOverride(t *testing.T) {
Payload: []byte{0x05, 0x06, 0x07, 0x08}, Payload: []byte{0x05, 0x06, 0x07, 0x08},
}) })
require.NoError(t, err) require.NoError(t, err)
} else {
err = s1.WritePacketRTP(medi, &rtp.Packet{
Header: rtp.Header{
Version: 0x02,
PayloadType: 96,
SequenceNumber: 57899,
Timestamp: 345234345,
SSRC: 978651231,
Marker: true,
},
Payload: []byte{0x01, 0x02, 0x03, 0x04},
})
require.NoError(t, err)
} }
<-frameRecv <-frameRecv