mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Extract TestPairSearch from agent_test.go
to separate file.
This commit is contained in:
committed by
Arthur Shellunts
parent
4dea7246b6
commit
0d1c333fcd
@@ -0,0 +1,39 @@
|
||||
//go:build !js
|
||||
// +build !js
|
||||
|
||||
package ice
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/pion/transport/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPairSearch(t *testing.T) {
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
// Limit runtime in case of deadlocks
|
||||
lim := test.TimeOut(time.Second * 10)
|
||||
defer lim.Stop()
|
||||
|
||||
var config AgentConfig
|
||||
a, err := NewAgent(&config)
|
||||
if err != nil {
|
||||
t.Fatalf("Error constructing ice.Agent")
|
||||
}
|
||||
|
||||
if len(a.checklist) != 0 {
|
||||
t.Fatalf("TestPairSearch is only a valid test if a.validPairs is empty on construction")
|
||||
}
|
||||
|
||||
cp := a.getBestAvailableCandidatePair()
|
||||
|
||||
if cp != nil {
|
||||
t.Fatalf("No Candidate pairs should exist")
|
||||
}
|
||||
|
||||
assert.NoError(t, a.Close())
|
||||
}
|
||||
@@ -31,33 +31,6 @@ func (m *mockPacketConn) SetDeadline(t time.Time) error {
|
||||
func (m *mockPacketConn) SetReadDeadline(t time.Time) error { return nil }
|
||||
func (m *mockPacketConn) SetWriteDeadline(t time.Time) error { return nil }
|
||||
|
||||
func TestPairSearch(t *testing.T) {
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
// Limit runtime in case of deadlocks
|
||||
lim := test.TimeOut(time.Second * 10)
|
||||
defer lim.Stop()
|
||||
|
||||
var config AgentConfig
|
||||
a, err := NewAgent(&config)
|
||||
if err != nil {
|
||||
t.Fatalf("Error constructing ice.Agent")
|
||||
}
|
||||
|
||||
if len(a.checklist) != 0 {
|
||||
t.Fatalf("TestPairSearch is only a valid test if a.validPairs is empty on construction")
|
||||
}
|
||||
|
||||
cp := a.getBestAvailableCandidatePair()
|
||||
|
||||
if cp != nil {
|
||||
t.Fatalf("No Candidate pairs should exist")
|
||||
}
|
||||
|
||||
assert.NoError(t, a.Close())
|
||||
}
|
||||
|
||||
func TestPairPriority(t *testing.T) {
|
||||
report := test.CheckRoutines(t)
|
||||
defer report()
|
||||
|
||||
Reference in New Issue
Block a user