mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix TCP RACK flaky unit tests.
- Added delay to increase the RTT: In DSACK tests with RACK enabled and low RTT, TLP can be detected before sending ACK and the tests flake. Increasing the RTT will ensure that TLP does not happen before the ACK is sent. - Fix TestRACKOnePacketTailLoss: The ACK does not contain DSACK, which means either the original or retransmission (probe) was lost and SACKRecovery count must be incremented. Before: http://sponge2/c9bd51de-f72f-481c-a7f3-e782e7524883 After: http://sponge2/1307a796-103a-4a45-b699-e8d239220ed1 PiperOrigin-RevId: 369305720
This commit is contained in:
committed by
gVisor bot
parent
b0333d33a2
commit
8ad6657a22
@@ -33,6 +33,7 @@ const (
|
||||
tsOptionSize = 12
|
||||
maxTCPOptionSize = 40
|
||||
mtu = header.TCPMinimumSize + header.IPv4MinimumSize + maxTCPOptionSize + maxPayload
|
||||
latency = 5 * time.Millisecond
|
||||
)
|
||||
|
||||
func setStackRACKPermitted(t *testing.T, c *context.Context) {
|
||||
@@ -182,6 +183,9 @@ func sendAndReceiveWithSACK(t *testing.T, c *context.Context, numPackets int, en
|
||||
for i := 0; i < numPackets; i++ {
|
||||
c.ReceiveAndCheckPacketWithOptions(data, bytesRead, maxPayload, tsOptionSize)
|
||||
bytesRead += maxPayload
|
||||
// This delay is added to increase RTT as low RTT can cause TLP
|
||||
// before sending ACK.
|
||||
time.Sleep(latency)
|
||||
}
|
||||
|
||||
return data
|
||||
@@ -479,7 +483,7 @@ func TestRACKOnePacketTailLoss(t *testing.T) {
|
||||
}{
|
||||
// #3 was retransmitted as TLP.
|
||||
{tcpStats.FastRetransmit, "stats.TCP.FastRetransmit", 0},
|
||||
{tcpStats.SACKRecovery, "stats.TCP.SACKRecovery", 0},
|
||||
{tcpStats.SACKRecovery, "stats.TCP.SACKRecovery", 1},
|
||||
{tcpStats.TLPRecovery, "stats.TCP.TLPRecovery", 0},
|
||||
// RTO should not have fired.
|
||||
{tcpStats.Timeouts, "stats.TCP.Timeouts", 0},
|
||||
|
||||
Reference in New Issue
Block a user