From 47bcd2cbebf1aa0e0012f865bbbe8c62cc6cfd31 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 13 Jul 2022 12:33:17 -0700 Subject: [PATCH] GH-2258: Add skip decorator to DNS unit tests --- ci/test.sh | 2 +- src/DNS_Mgr.cc | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ci/test.sh b/ci/test.sh index ba407ffec6..f26234b7bc 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -39,7 +39,7 @@ function run_unit_tests { banner "Running unit tests" pushd build - (. ./zeek-path-dev.sh && zeek --test) || result=1 + (. ./zeek-path-dev.sh && zeek --test --no-skip) || result=1 popd return 0 } diff --git a/src/DNS_Mgr.cc b/src/DNS_Mgr.cc index f1fff3f864..46739eeddf 100644 --- a/src/DNS_Mgr.cc +++ b/src/DNS_Mgr.cc @@ -1540,6 +1540,12 @@ TableValPtr DNS_Mgr::empty_addr_set() ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// +// Unit testing coverage for the DNS_Mgr code, including making actual DNS requests to +// test responses and timeouts. Note that all of these tests are marked with the skip +// decorator, since they take some time to run and this slows down local developement. To +// run them manually, pass the --no-skip flag when running tests. These tests are +// run automatically as part of CI builds. + static std::vector get_result_addresses(TableValPtr addrs) { std::vector results; @@ -1605,7 +1611,7 @@ void TestDNS_Mgr::Process() IssueAsyncRequests(); } -TEST_CASE("dns_mgr priming") +TEST_CASE("dns_mgr priming" * doctest::skip(true)) { char prefix[] = "/tmp/zeek-unit-test-XXXXXX"; auto tmpdir = mkdtemp(prefix); @@ -1654,7 +1660,7 @@ TEST_CASE("dns_mgr priming") rmdir(tmpdir); } -TEST_CASE("dns_mgr alternate server") +TEST_CASE("dns_mgr alternate server" * doctest::skip(true)) { char* old_server = getenv("ZEEK_DNS_RESOLVER"); @@ -1683,7 +1689,7 @@ TEST_CASE("dns_mgr alternate server") unsetenv("ZEEK_DNS_RESOLVER"); } -TEST_CASE("dns_mgr default mode") +TEST_CASE("dns_mgr default mode" * doctest::skip(true)) { TestDNS_Mgr mgr(DNS_DEFAULT); mgr.InitPostScript(); @@ -1715,7 +1721,7 @@ TEST_CASE("dns_mgr default mode") CHECK(strcmp(addr_result->CheckString(), "240.0.0.0") == 0); } -TEST_CASE("dns_mgr async host") +TEST_CASE("dns_mgr async host" * doctest::skip(true)) { TestDNS_Mgr mgr(DNS_DEFAULT); mgr.InitPostScript(); @@ -1746,7 +1752,7 @@ TEST_CASE("dns_mgr async host") mgr.Flush(); } -TEST_CASE("dns_mgr async addr") +TEST_CASE("dns_mgr async addr" * doctest::skip(true)) { TestDNS_Mgr mgr(DNS_DEFAULT); mgr.InitPostScript(); @@ -1772,7 +1778,7 @@ TEST_CASE("dns_mgr async addr") mgr.Flush(); } -TEST_CASE("dns_mgr async text") +TEST_CASE("dns_mgr async text" * doctest::skip(true)) { TestDNS_Mgr mgr(DNS_DEFAULT); mgr.InitPostScript(); @@ -1798,7 +1804,7 @@ TEST_CASE("dns_mgr async text") mgr.Flush(); } -TEST_CASE("dns_mgr timeouts") +TEST_CASE("dns_mgr timeouts" * doctest::skip(true)) { char* old_server = getenv("ZEEK_DNS_RESOLVER"); @@ -1824,7 +1830,7 @@ TEST_CASE("dns_mgr timeouts") unsetenv("ZEEK_DNS_RESOLVER"); } -TEST_CASE("dns_mgr async timeouts") +TEST_CASE("dns_mgr async timeouts" * doctest::skip(true)) { char* old_server = getenv("ZEEK_DNS_RESOLVER");