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

Commit 0a86750f authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Deflake doDualStackProvisioning

The current implementation is flaky because DHCP packets received while
waiting for IPv6 provisioning are lost.

Bug: 159298830
Test: atest IpClientIntegrationTest#testDualStackProvisioning \
          --rerun-until-failure 50
Change-Id: I13dc66aff425650054aab5100c7ba6fe97f07e3a
parent 7a21cda8
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -1240,12 +1240,16 @@ public class IpClientIntegrationTest {
                        == (byte) ICMPV6_ROUTER_SOLICITATION;
    }

    private void waitForRouterSolicitation() throws ParseException {
        byte[] packet;
        while ((packet = mPacketReader.popPacket(PACKET_TIMEOUT_MS)) != null) {
            if (isRouterSolicitation(packet)) return;
        }
        fail("No router solicitation received on interface within timeout");
    /**
     * Wait for any router solicitation to have arrived since the packet reader was received.
     *
     * This method does not affect packets obtained via mPacketReader.popPacket. After any router
     * solicitation has been received, calls to this method will just return immediately.
     */
    private void waitForRouterSolicitation() {
        assertNotNull("No router solicitation received on interface within timeout",
                mPacketReader.getReceivedPackets().poll(
                        PACKET_TIMEOUT_MS, 0 /* pos */, this::isRouterSolicitation));
    }

    private void sendRouterAdvertisement(boolean waitForRs, short lifetime) throws Exception {
+8 −0
Original line number Diff line number Diff line
@@ -72,6 +72,14 @@ public class TapPacketReader extends PacketReader {
        return mReadHead.getValue().poll(timeoutMs, filter::test);
    }

    /**
     * Get the {@link ArrayTrackRecord} that records all packets received by the reader since its
     * creation.
     */
    public ArrayTrackRecord<byte[]> getReceivedPackets() {
        return mReceivedPackets;
    }

    public void sendResponse(final ByteBuffer packet) throws IOException {
        try (FileOutputStream out = new FileOutputStream(mTapFd)) {
            byte[] packetBytes = new byte[packet.limit()];