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
This commit is contained in:
Jimi Chen 2025-08-06 08:29:07 +00:00
commit 003403e237

View file

@ -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
)