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

Commit d93ed608 authored by Mike Yu's avatar Mike Yu
Browse files

Test: Deflake SkipUnusableTlsServer

Fix the test to pass when the flag dot_async_handshake is 1

Bug: 261327438
Test: run the test with dot_async_handshake=1
Test: run the test with dot_async_handshake=0
Change-Id: Ie3b020a1a55a5da05e0aec2b56c2c3d05f0365b1
parent 497fc636
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -4952,8 +4952,16 @@ TEST_F(ResolverTest, SkipUnusableTlsServer) {
            expectAnswersValid(fd, AF_INET6, kHelloExampleComAddrV6);
        }

        if (GetProperty(kDotAsyncHandshakeFlag, "0") == "0") {
            EXPECT_EQ(dot1.acceptConnectionsCount(), config.expectedQueriesSentToDot1);
            EXPECT_EQ(dot2.acceptConnectionsCount(), config.expectedQueriesSentToDot2);
        } else {
            // If the flag dot_async_handshake is set to 1, the DnsResolver will try
            // DoT connection establishment at most |retries| times.
            const int retries = std::stoi(GetProperty(kDotMaxretriesFlag, "3"));
            EXPECT_EQ(dot1.acceptConnectionsCount(), config.expectedQueriesSentToDot1 * retries);
            EXPECT_EQ(dot2.acceptConnectionsCount(), config.expectedQueriesSentToDot2 * retries);
        }
    }
}