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

Commit 15c6f7f7 authored by Mike Yu's avatar Mike Yu Committed by Automerger Merge Worker
Browse files

Fix flaky ResolverTest.DnsServerSelection due to flag reset am: bb8ccef1 am: 437fce03

Original change: https://android-review.googlesource.com/c/platform/packages/modules/DnsResolver/+/1552338

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I064be0e087a71e7a477e161ddf4da9c3acc89e40
parents 3498f64d 437fce03
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -5431,8 +5431,6 @@ TEST_F(ResolverTest, DnsServerSelection) {
    StartDns(dns2, {{kHelloExampleCom, ns_type::ns_t_a, kHelloExampleComAddrV4}});
    StartDns(dns2, {{kHelloExampleCom, ns_type::ns_t_a, kHelloExampleComAddrV4}});
    StartDns(dns3, {{kHelloExampleCom, ns_type::ns_t_a, kHelloExampleComAddrV4}});
    StartDns(dns3, {{kHelloExampleCom, ns_type::ns_t_a, kHelloExampleComAddrV4}});


    ScopedSystemProperties scopedSystemProperties(kSortNameserversFlag, "1");

    // NOTE: the servers must be sorted alphabetically.
    // NOTE: the servers must be sorted alphabetically.
    std::vector<std::string> serverList = {
    std::vector<std::string> serverList = {
            dns1.listen_address(),
            dns1.listen_address(),
@@ -5445,6 +5443,9 @@ TEST_F(ResolverTest, DnsServerSelection) {
        const int queryNum = 50;
        const int queryNum = 50;
        int64_t accumulatedTime = 0;
        int64_t accumulatedTime = 0;


        // The flag can be reset any time. It's better to re-setup the flag in each iteration.
        ScopedSystemProperties scopedSystemProperties(kSortNameserversFlag, "1");

        // Restart the testing network to 1) make the flag take effect and 2) reset the statistics.
        // Restart the testing network to 1) make the flag take effect and 2) reset the statistics.
        resetNetwork();
        resetNetwork();