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

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

Make PrivateDnsDohTest.SessionResumption more robust against flag reset

This test usually takes 7 seconds to finish, and resetNetwork() is
called during the test. If the flag "doh" is set to 0 during the
test, the test will fail. Therefore, this change adds another
ScopedSystemProperties for "doh" right before resetNetwork().

Bug: 222023286
Test: ran PrivateDnsDohTest.SessionResumption
Change-Id: I4831cfa4324b5970db0f281afacba8141929520c
parent 562775e4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -974,7 +974,14 @@ TEST_F(PrivateDnsDohTest, ConnectionIdleTimer) {
TEST_F(PrivateDnsDohTest, SessionResumption) {
    const int initial_max_idle_timeout_ms = 1000;
    for (const auto& flag : {"0", "1"}) {
        SCOPED_TRACE(fmt::format("flag: {}", flag));
        auto sp = make_unique<ScopedSystemProperties>(kDohSessionResumptionFlag, flag);

        // Each loop takes around 3 seconds, if the system property "doh" is reset in the middle
        // of the first loop, this test will fail when running the second loop because DnsResolver
        // updates its "doh" flag when resetNetwork() is called. Therefore, add another
        // ScopedSystemProperties for "doh" to make the test more robust.
        auto sp2 = make_unique<ScopedSystemProperties>(kDohFlag, "1");
        resetNetwork();

        ASSERT_TRUE(doh.stopServer());