From 6f47d657352abd062aa9ff7e8b387405c5a574f2 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 1 Oct 2025 06:59:35 -0700 Subject: [PATCH] test for name resolution during *::Config::expand() --- test/testconfig.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/test/testconfig.cpp b/test/testconfig.cpp index 5c845ea..1a3ef6f 100644 --- a/test/testconfig.cpp +++ b/test/testconfig.cpp @@ -175,17 +175,48 @@ void testClientAuto() testFalse(conf.addressList.empty())< expect({"127.0.0.1"}); + client::Config conf; + conf.addressList = expect; // copy + conf.autoAddrList = false; + conf.expand(); + testArrEq(conf.addressList, expect)<<" numeric address"; + } + { + std::vector expect({"127.0.0.1"}); + client::Config conf; + conf.addressList.push_back("localhost"); // copy + conf.autoAddrList = false; + conf.expand(); + testArrEq(conf.addressList, expect)<<" localhost"; + } + { + std::vector expect; + client::Config conf; + conf.addressList.push_back("16name.invalid"); // expect failure unless host resolver is hijacking + conf.autoAddrList = false; + conf.expand(); + testArrEq(conf.addressList, expect)<<" invalid hostname"; + } +} + } // namespace MAIN(testconfig) { - testPlan(31); + testPlan(34); testSetup(); testDefs(); logger_config_env(); testParse(); testServerAuto(); testClientAuto(); + testDNS(); cleanup_for_valgrind(); return testDone(); }