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

Commit 560c1ea8 authored by Mike Yu's avatar Mike Yu Committed by Automerger Merge Worker
Browse files

Test: Deflake RepeatedSetup_KeepChangingPrivateDnsServers am: 19b5229f

parents 0bf76b19 19b5229f
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -5795,17 +5795,17 @@ TEST_F(ResolverTest, RepeatedSetup_KeepChangingPrivateDnsServers) {
                // Must be UNRESPONSIVE.
                // Must be UNRESPONSIVE.
                // DnsTlsFrontend is the only signal for checking whether or not the resolver starts
                // DnsTlsFrontend is the only signal for checking whether or not the resolver starts
                // another validation when the server is unresponsive.
                // another validation when the server is unresponsive.
                const int expectCountDiff =

                        config.expectNothingHappenWhenServerUnresponsive ? 0 : 1;
                // Wait for a while to avoid running the checker code too early.
                if (expectCountDiff == 0) {
                std::this_thread::sleep_for(200ms);
                    // It's possible that the resolver hasn't yet started to
                if (!config.expectNothingHappenWhenServerUnresponsive) {
                    // connect. Wait a while.
                    std::this_thread::sleep_for(100ms);
                } else {
                    EXPECT_TRUE(WaitForPrivateDnsValidation(config.tlsServer, false));
                    EXPECT_TRUE(WaitForPrivateDnsValidation(config.tlsServer, false));
                }
                }
                const auto condition = [&]() {
                const auto condition = [&]() {
                    return tls.acceptConnectionsCount() == connectCountsBefore + expectCountDiff;
                    const int connectCountsAfter = tls.acceptConnectionsCount();
                    return config.expectNothingHappenWhenServerUnresponsive
                                   ? (connectCountsAfter == connectCountsBefore)
                                   : (connectCountsAfter > connectCountsBefore);
                };
                };
                EXPECT_TRUE(PollForCondition(condition));
                EXPECT_TRUE(PollForCondition(condition));
            }
            }