From 897546d596d8d7213cff60146123bb8f97d4d1cc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 24 Sep 2025 21:28:56 +0100 Subject: Create settings structure Holds all the settings and their defaults for use in program_options and tests. Disables missing-field-initializers in tests because its over sensitive to structures with defaults where you only provide some values specifically. --- test/Jamfile.jam | 1 + test/perf-ingest.cpp | 7 +++++-- test/test-ingest.cpp | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/Jamfile.jam b/test/Jamfile.jam index 217feec..493c5bc 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -12,6 +12,7 @@ project WebStat-Testing : requirements TEST=\"$(test)\" FIXTURES=\"$(fixtures)\" $(src)//webstat + gcc,debug:-Wno-missing-field-initializers ; lib test-util : diff --git a/test/perf-ingest.cpp b/test/perf-ingest.cpp index d05de17..3251107 100644 --- a/test/perf-ingest.cpp +++ b/test/perf-ingest.cpp @@ -21,8 +21,11 @@ namespace { void doIngestFile(benchmark::State & state) { - WebStat::Ingestor ingestor { - WebStat::getTestUtsName("perf-hostname"), std::make_shared("webstat")}; + WebStat::Ingestor ingestor {WebStat::getTestUtsName("perf-hostname"), + std::make_shared("webstat"), + { + .userAgentAPI = {}, + }}; for (auto loop : state) { WebStat::FilePtr logFile {fopen(TMP_LOG.c_str(), "r")}; ingestor.ingestLog(logFile.get()); diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp index 722763a..83bac48 100644 --- a/test/test-ingest.cpp +++ b/test/test-ingest.cpp @@ -195,9 +195,11 @@ BOOST_DATA_TEST_CASE(ExtractFields, class TestIngestor : public WebStat::Ingestor { public: TestIngestor() : - WebStat::Ingestor {WebStat::getTestUtsName("test-hostname"), std::make_shared("webstat")} + WebStat::Ingestor {WebStat::getTestUtsName("test-hostname"), std::make_shared("webstat"), + { + .userAgentAPI = FIXTURE_URL_BASE + "/userAgent.json", + }} { - userAgentAPI = FIXTURE_URL_BASE + "/userAgent.json"; } }; @@ -233,7 +235,7 @@ BOOST_AUTO_TEST_CASE(FetchMockUserAgentDetail) { const auto uaDetailReq = WebStat::curlGetUserAgentDetail(0, R"(Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36)", - userAgentAPI.c_str()); + settings.userAgentAPI.c_str()); BOOST_REQUIRE(uaDetailReq); BOOST_REQUIRE_EQUAL(CURLE_OK, curl_easy_perform(uaDetailReq->hnd.get())); -- cgit v1.2.3