MCPcopy Create free account
hub / github.com/pion/ice / TestRemoteCandidateStats

Function TestRemoteCandidateStats

agent_test.go:1516–1603  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1514}
1515
1516func TestRemoteCandidateStats(t *testing.T) { //nolint:cyclop
1517 defer test.CheckRoutines(t)()
1518
1519 // Avoid deadlocks?
1520 defer test.TimeOut(1 * time.Second).Stop()
1521
1522 agent, err := NewAgent(&AgentConfig{})
1523 require.NoError(t, err)
1524 defer func() {
1525 require.NoError(t, agent.Close())
1526 }()
1527
1528 relayConfig := &CandidateRelayConfig{
1529 Network: "udp",
1530 Address: "1.2.3.4",
1531 Port: 12340,
1532 Component: 1,
1533 RelAddr: "4.3.2.1",
1534 RelPort: 43210,
1535 }
1536 relayRemote, err := NewCandidateRelay(relayConfig)
1537 require.NoError(t, err)
1538
1539 srflxConfig := &CandidateServerReflexiveConfig{
1540 Network: "udp",
1541 Address: "10.10.10.2",
1542 Port: 19218,
1543 Component: 1,
1544 RelAddr: "4.3.2.1",
1545 RelPort: 43212,
1546 }
1547 srflxRemote, err := NewCandidateServerReflexive(srflxConfig)
1548 require.NoError(t, err)
1549
1550 prflxConfig := &CandidatePeerReflexiveConfig{
1551 Network: "udp",
1552 Address: "10.10.10.2",
1553 Port: 19217,
1554 Component: 1,
1555 RelAddr: "4.3.2.1",
1556 RelPort: 43211,
1557 }
1558 prflxRemote, err := NewCandidatePeerReflexive(prflxConfig)
1559 require.NoError(t, err)
1560
1561 hostConfig := &CandidateHostConfig{
1562 Network: "udp",
1563 Address: "1.2.3.5",
1564 Port: 12350,
1565 Component: 1,
1566 }
1567 hostRemote, err := NewCandidateHost(hostConfig)
1568 require.NoError(t, err)
1569
1570 agent.remoteCandidates[NetworkTypeUDP4] = []Candidate{relayRemote, srflxRemote, prflxRemote, hostRemote}
1571
1572 remoteStats := agent.GetRemoteCandidatesStats()
1573 require.Len(t, remoteStats, 4)

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
TypeMethod · 0.95
PriorityMethod · 0.95
AddressMethod · 0.95
NewAgentFunction · 0.85
NewCandidateRelayFunction · 0.85
NewCandidateHostFunction · 0.85
IDMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…