From 003403e237276b71a5b90372857789f53c61ed90 Mon Sep 17 00:00:00 2001 From: Jimi Chen Date: Wed, 6 Aug 2025 08:29:07 +0000 Subject: [PATCH] Stabilize flaky tests by adding packet delay Introduce a 3-second delay in each packet send. Before sending each packet, wait for 3 seconds to give the firmware time to turn on the APF. The firmware may have throughput calculation logic that depends on a certain time window. Flag: EXEMPT test only Bug: 434614102 Test: atest CtsConnectivityMultiDevicesTestCases:ApfV6Test Test: ./cts-tradefed run commandAndExit cts \ -m CtsConnectivityMultiDevicesTestCases \ -t ApfV6Test --shard-count 2 Change-Id: I0807562cd87cbfe90c90d48cf2d0e41673c153b0 --- staticlibs/testutils/host/python/apf_test_base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/staticlibs/testutils/host/python/apf_test_base.py b/staticlibs/testutils/host/python/apf_test_base.py index a2cb6249a8..4653c3b4a8 100644 --- a/staticlibs/testutils/host/python/apf_test_base.py +++ b/staticlibs/testutils/host/python/apf_test_base.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import time from mobly import asserts from net_tests_utils.host.python import adb_utils, apf_utils, assert_utils, multi_devices_test_base, tether_utils from net_tests_utils.host.python.tether_utils import UpstreamType @@ -146,6 +147,8 @@ class ApfTestBase(multi_devices_test_base.MultiDevicesTestBase): # send 3 packets to prevent flaky test result for _ in range(3): + # Sleep for 3 seconds to give the firmware a time buffer to turn on the APF. + time.sleep(3) apf_utils.send_raw_packet_downstream( self.serverDevice, self.server_iface_name, send_packet )