summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-17 17:33:14 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-17 17:33:14 +0000
commitae0ee6bbfb4dcd1f112876d0e7e5b3bcabdfb002 (patch)
tree406c7383b4b710547688e9f46e48ae9f491b5912 /test
parentfc96582867acd2bcaef29feaae5c1193969d9a27 (diff)
downloadwebstat-ae0ee6bbfb4dcd1f112876d0e7e5b3bcabdfb002.tar.bz2
webstat-ae0ee6bbfb4dcd1f112876d0e7e5b3bcabdfb002.tar.xz
webstat-ae0ee6bbfb4dcd1f112876d0e7e5b3bcabdfb002.zip
Use std::future over std::thread for background jobsHEADmain
Easier checking if a job has completed [successfully] and reseting state for the next time.
Diffstat (limited to 'test')
-rw-r--r--test/test-ingest.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp
index 558444d..41b3690 100644
--- a/test/test-ingest.cpp
+++ b/test/test-ingest.cpp
@@ -311,7 +311,9 @@ BOOST_AUTO_TEST_CASE(IngestParkedJob,
ingestParkedLines.lastRun = now - settings.freqIngestParkedLines - 1s;
runJobsAsNeeded();
BOOST_REQUIRE(ingestParkedLines.currentRun);
- ingestParkedLines.currentRun->join();
+ ingestParkedLines.currentRun->wait();
+ runJobsAsNeeded();
+ BOOST_REQUIRE(!ingestParkedLines.currentRun);
BOOST_CHECK_EQUAL(linesParsed, 1);
BOOST_CHECK_EQUAL(linesDiscarded, 0);
BOOST_CHECK_GE(ingestParkedLines.lastRun, now);
@@ -326,7 +328,9 @@ BOOST_AUTO_TEST_CASE(JobErrorRescheduler, *boost::unit_test::depends_on("I/Inges
std::filesystem::permissions(settings.fallbackDir / LOGLINE1_PARKED, std::filesystem::perms::owner_write);
runJobsAsNeeded();
BOOST_REQUIRE(ingestParkedLines.currentRun);
- ingestParkedLines.currentRun->join();
+ ingestParkedLines.currentRun->wait();
+ runJobsAsNeeded();
+ BOOST_REQUIRE(!ingestParkedLines.currentRun);
BOOST_CHECK(std::filesystem::exists(settings.fallbackDir / LOGLINE1_PARKED));
BOOST_CHECK_GE(ingestParkedLines.lastRun, now - (settings.freqIngestParkedLines / 2) - 1s);
BOOST_CHECK_LE(ingestParkedLines.lastRun, now - (settings.freqIngestParkedLines / 2) + 1s);