intermittent unit test failure: test/net_tests.cpp(311): error: in "net_tests/cnetaddr_basic": check addr_str == scoped_addr || addr_str == "fe80:0:0:0:0:0:0:1" has failed #21682
issue MarcoFalke opened this issue on April 14, 2021-
MarcoFalke commented at 5:55 PM on April 14, 2021: member
- MarcoFalke added the label Bug on Apr 14, 2021
-
jonatack commented at 6:23 PM on April 14, 2021: member
Thanks. Was about to push a fix after @ryanofsky reported on it lately.
-
jonatack commented at 6:24 PM on April 14, 2021: member
-
practicalswift commented at 10:45 PM on April 14, 2021: contributor
I've looked at that test before and I don't think that specific
BOOST_CHECKmakes much sense TBH :)1.) I don't understand why we test if
ToString()output includes%zone_index: it clearly doesn't on some platforms, so we cannot rely on it anyways. Then why test it?2.) And perhaps more fundamentally: why would we even want to have
%zone_indexin our textualToString()output? I think the expectation is to get sayfe80::1ff:fe23:4567:890a(without zone index) and not sayfe80::1ff:fe23:4567:890a%eth2orfe80::1ff:fe23:4567:890a%3when doingipv6_addr.ToString():)Suggested solution:
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index 8eab26f3d..61cb381aa 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -307,10 +307,6 @@ BOOST_AUTO_TEST_CASE(cnetaddr_basic) BOOST_REQUIRE(addr.IsValid()); BOOST_REQUIRE(addr.IsIPv6()); BOOST_CHECK(!addr.IsBindAny()); - const std::string addr_str{addr.ToString()}; - BOOST_CHECK(addr_str == scoped_addr || addr_str == "fe80:0:0:0:0:0:0:1"); - // The fallback case "fe80:0:0:0:0:0:0:1" is needed for macOS 10.14/10.15 and (probably) later. // Test that the delimiter "%" and default zone id of 0 can be omitted for the default scope. BOOST_REQUIRE(LookupHost(link_local + "%0", addr, false)); BOOST_REQUIRE(addr.IsValid()); BOOST_REQUIRE(addr.IsIPv6());:)
- MarcoFalke added this to the milestone 22.0 on Apr 15, 2021
- MarcoFalke closed this on Apr 17, 2021
-
jonatack commented at 10:19 AM on April 17, 2021: member
Noting here that this was also fixed by #21690 as I wrote above in #21682 (comment) that I would do. #21690 not only fixed the issue but also kept the test coverage and improved the contextual information to avoid the confusion above and that I think was worth keeping.
- sidhujag referenced this in commit 94b99db6d3 on Apr 17, 2021
- PastaPastaPasta referenced this in commit 437ecceadc on Jun 27, 2021
- PastaPastaPasta referenced this in commit 7d6d33b123 on Jun 28, 2021
- PastaPastaPasta referenced this in commit 45711c5738 on Jun 29, 2021
- DrahtBot locked this on Aug 18, 2022