Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlu committed Dec 4, 2024
1 parent ccae17a commit 87d1327
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/network/tracer/tracer_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,22 +304,22 @@ func (s *TracerSuite) TestTCPRTT() {
// Fetch connection matching source and target address
allConnections := getConnections(t, tr)
conn, ok := findConnection(c.LocalAddr(), c.RemoteAddr(), allConnections)
if !assert.True(t, ok) {
if !assert.True(ct, ok) {
return
}

if cfg.EnableEbpfless {
timeoutUs := uint32((10 * time.Second).Microseconds())
// On ebpfless, we don't have the same timestamps as the kernel so all
// we can do is sanity check that RTT is nonzero and not huge
assert.Greater(t, int(conn.RTT), 0)
assert.Less(t, conn.RTT, timeoutUs)
assert.Greater(t, int(conn.RTTVar), 0)
assert.Less(t, conn.RTTVar, timeoutUs)
assert.Greater(ct, int(conn.RTT), 0)
assert.Less(ct, conn.RTT, timeoutUs)
assert.Greater(ct, int(conn.RTTVar), 0)
assert.Less(ct, conn.RTTVar, timeoutUs)
} else {
// Assert that values returned from syscall match ones generated by eBPF program
assert.EqualValues(t, int(tcpInfo.Rtt), int(conn.RTT))
assert.EqualValues(t, int(tcpInfo.Rttvar), int(conn.RTTVar))
assert.EqualValues(ct, int(tcpInfo.Rtt), int(conn.RTT))
assert.EqualValues(ct, int(tcpInfo.Rttvar), int(conn.RTTVar))
}
}, 3*time.Second, 100*time.Millisecond)
}
Expand Down

0 comments on commit 87d1327

Please sign in to comment.