(t *testing.T)
| 1656 | } |
| 1657 | |
| 1658 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…