Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac02bc81 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Fix flaky testNattSocketKeepalives

The test did not wait for the WifiNetworkAgent to disconnect, and there
are reports of flakes where it is still connected in
connectKeepaliveNetwork.

Test: atest FrameworksNetTests
Bug: 124319553
Change-Id: I85968806885c8853ec4f4dbea356366c1af0ea1c
parent f46b14b6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3791,11 +3791,14 @@ public class ConnectivityServiceTest {
    }

    @Test
    public void testNattSocketKeepalives() throws Exception {
    public void testNattSocketKeepalives_SingleThreadExecutor() throws Exception {
        final ExecutorService executorSingleThread = Executors.newSingleThreadExecutor();
        doTestNattSocketKeepalivesWithExecutor(executorSingleThread);
        executorSingleThread.shutdown();
    }

    @Test
    public void testNattSocketKeepalives_InlineExecutor() throws Exception {
        final Executor executorInline = (Runnable r) -> r.run();
        doTestNattSocketKeepalivesWithExecutor(executorInline);
    }
@@ -3937,6 +3940,7 @@ public class ConnectivityServiceTest {
        testSocket2.close();

        mWiFiNetworkAgent.disconnect();
        waitFor(mWiFiNetworkAgent.getDisconnectedCV());
    }

    @Test