Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Mar 6, 2024
1 parent c8c5bf8 commit 9fa8b3f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/protocols/webrtc/peer_connection_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package webrtc

import (
"testing"
"time"

"github.com/bluenviron/mediamtx/internal/test"
"github.com/stretchr/testify/require"
)

func TestPeerConnectionCloseAfterError(t *testing.T) {
api, err := NewAPI(APIConf{
LocalRandomUDP: true,
IPsFromInterfaces: true,
})
require.NoError(t, err)

pc := &PeerConnection{
API: api,
Publish: false,
Log: test.NilLogger{},
}
err = pc.Start()
require.NoError(t, err)

_, err = pc.CreatePartialOffer()
require.NoError(t, err)

// wait for ICE candidates to be generated
time.Sleep(500 * time.Millisecond)

pc.Close()
}

0 comments on commit 9fa8b3f

Please sign in to comment.