summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-09-24 21:28:56 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-09-24 21:33:13 +0100
commit897546d596d8d7213cff60146123bb8f97d4d1cc (patch)
treeaa3ec6a8db09d6eaf915805986e57d691c7d11f6 /test
parent71803b97f1c9e31f2027da48bb742353f9c43e62 (diff)
downloadwebstat-897546d596d8d7213cff60146123bb8f97d4d1cc.tar.bz2
webstat-897546d596d8d7213cff60146123bb8f97d4d1cc.tar.xz
webstat-897546d596d8d7213cff60146123bb8f97d4d1cc.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam1
-rw-r--r--test/perf-ingest.cpp7
-rw-r--r--test/test-ingest.cpp8
3 files changed, 11 insertions, 5 deletions
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
<define>TEST=\"$(test)\"
<define>FIXTURES=\"$(fixtures)\"
<library>$(src)//webstat
+ <toolset>gcc,<variant>debug:<cflags>-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::MockDBPool>("webstat")};
+ WebStat::Ingestor ingestor {WebStat::getTestUtsName("perf-hostname"),
+ std::make_shared<WebStat::MockDBPool>("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<MockDBPool>("webstat")}
+ WebStat::Ingestor {WebStat::getTestUtsName("test-hostname"), std::make_shared<MockDBPool>("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()));