EthernetTetheringTest: give slack time for waiting UDP stream mode

Give slack time for waiting UDP stream mode because handling conntrack
event in user space may not in precise time. Used to reduce the flaky
rate.

Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: I7aee1a45d9a4d4fecf09739488dcaadeb7e86655
This commit is contained in:
Hungming Chen
2022-09-05 21:07:36 +08:00
parent 05021aa886
commit dc311c8aa5

View File

@@ -139,6 +139,9 @@ public class EthernetTetheringTest {
// Kernel treats a confirmed UDP connection which active after two seconds as stream mode.
// See upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5.
private static final int UDP_STREAM_TS_MS = 2000;
// Give slack time for waiting UDP stream mode because handling conntrack event in user space
// may not in precise time. Used to reduce the flaky rate.
private static final int UDP_STREAM_SLACK_MS = 500;
// Per RX UDP packet size: iphdr (20) + udphdr (8) + payload (2) = 30 bytes.
private static final int RX_UDP_PACKET_SIZE = 30;
private static final int RX_UDP_PACKET_COUNT = 456;
@@ -1171,6 +1174,9 @@ public class EthernetTetheringTest {
Thread.sleep(UDP_STREAM_TS_MS);
sendUploadPacketUdp(srcMac, dstMac, clientIp, remoteIp, tester, false /* is4To6 */);
// Give a slack time for handling conntrack event in user space.
Thread.sleep(UDP_STREAM_SLACK_MS);
// [1] Verify IPv4 upstream rule map.
final HashMap<Tether4Key, Tether4Value> upstreamMap = pollRawMapFromDump(
Tether4Key.class, Tether4Value.class, DUMPSYS_RAWMAP_ARG_UPSTREAM4);