TestControlledSelector_TriggeredCheckDuringChecking verifies that a triggered check IS sent when the pair is not yet in Succeeded state (normal ICE checking).
(t *testing.T)
| 424 | // TestControlledSelector_TriggeredCheckDuringChecking verifies that a triggered |
| 425 | // check IS sent when the pair is not yet in Succeeded state (normal ICE checking). |
| 426 | func TestControlledSelector_TriggeredCheckDuringChecking(t *testing.T) { |
| 427 | agent := bareAgentForPing() |
| 428 | agent.log = logging.NewDefaultLoggerFactory().NewLogger("test") |
| 429 | agent.remoteUfrag = selectionTestRemoteUfrag |
| 430 | agent.localUfrag = selectionTestLocalUfrag |
| 431 | agent.remotePwd = selectionTestPassword |
| 432 | agent.localPwd = selectionTestPassword |
| 433 | agent.tieBreaker = 1 |
| 434 | agent.isControlling.Store(false) |
| 435 | agent.onConnected = make(chan struct{}) |
| 436 | agent.setSelector() |
| 437 | |
| 438 | selector, ok := agent.getSelector().(*controlledSelector) |
| 439 | require.True(t, ok, "expected controlledSelector") |
| 440 | |
| 441 | local := newPingNoIOCand() |
| 442 | local.candidateBase.networkType = NetworkTypeUDP4 |
| 443 | local.candidateBase.resolvedAddr = &net.UDPAddr{IP: net.ParseIP("192.168.1.1"), Port: 10000} |
| 444 | |
| 445 | remote := newPingNoIOCand() |
| 446 | remote.candidateBase.networkType = NetworkTypeUDP4 |
| 447 | remote.candidateBase.resolvedAddr = &net.UDPAddr{IP: net.ParseIP("192.168.1.2"), Port: 20000} |
| 448 | |
| 449 | pair := agent.addPair(local, remote) |
| 450 | // Pair is in Waiting state (not Succeeded), no selected pair — normal ICE checking. |
| 451 | |
| 452 | sentBefore := pair.RequestsSent() |
| 453 | |
| 454 | msg, err := stun.Build(stun.BindingRequest, |
| 455 | stun.TransactionID, |
| 456 | stun.NewUsername(agent.localUfrag+":"+agent.remoteUfrag), |
| 457 | stun.NewShortTermIntegrity(agent.localPwd), |
| 458 | stun.Fingerprint, |
| 459 | ) |
| 460 | require.NoError(t, err) |
| 461 | |
| 462 | selector.HandleBindingRequest(msg, local, remote) |
| 463 | |
| 464 | assert.Greater(t, pair.RequestsSent(), sentBefore, |
| 465 | "triggered check should be sent during ICE checking phase") |
| 466 | } |
| 467 | |
| 468 | func TestAutomaticRenomination(t *testing.T) { //nolint:maintidx |
| 469 | report := test.CheckRoutines(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…