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

Function TestBindingRequestTimeout

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

Source from the content-addressed store, hash-verified

1656}
1657
1658func TestBindingRequestTimeout(t *testing.T) {
1659 defer test.CheckRoutines(t)()
1660
1661 const expectedRemovalCount = 2
1662
1663 agent, err := NewAgent(&AgentConfig{})
1664 require.NoError(t, err)
1665 defer func() {
1666 require.NoError(t, agent.Close())
1667 }()
1668
1669 now := time.Now()
1670 agent.pendingBindingRequests = append(agent.pendingBindingRequests, bindingRequest{
1671 timestamp: now, // Valid
1672 })
1673 agent.pendingBindingRequests = append(agent.pendingBindingRequests, bindingRequest{
1674 timestamp: now.Add(-3900 * time.Millisecond), // Valid
1675 })
1676 agent.pendingBindingRequests = append(agent.pendingBindingRequests, bindingRequest{
1677 timestamp: now.Add(-4100 * time.Millisecond), // Invalid
1678 })
1679 agent.pendingBindingRequests = append(agent.pendingBindingRequests, bindingRequest{
1680 timestamp: now.Add(-75 * time.Hour), // Invalid
1681 })
1682
1683 agent.invalidatePendingBindingRequests(now)
1684
1685 require.Equal(
1686 t,
1687 expectedRemovalCount,
1688 len(agent.pendingBindingRequests),
1689 "Binding invalidation due to timeout did not remove the correct number of binding requests",
1690 )
1691}
1692
1693// TestAgentCredentials checks if local username fragments and passwords (if set) meet RFC standard
1694// and ensure it's backwards compatible with previous versions of the pion/ice.

Callers

nothing calls this directly

Calls 4

CloseMethod · 0.95
NewAgentFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…