From f8d326a7d6f49a6b6009a7869ce61d782ad9c7b6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 8 Jul 2026 18:15:13 +0100 Subject: Add a const for the number of entities inserted so far Eases updating early tests without the need to change all the later expected id values. --- test/test-ingest.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp index cf5206f..a9966a5 100644 --- a/test/test-ingest.cpp +++ b/test/test-ingest.cpp @@ -514,6 +514,8 @@ BOOST_AUTO_TEST_CASE(FetchMockUserAgentDetail) } } +constexpr EntityId rollingEntityCounterBase = 18; + BOOST_AUTO_TEST_CASE(RecordUnparsable) { queuedLines.emplace_back("does not parse"); @@ -527,7 +529,7 @@ BOOST_AUTO_TEST_CASE(RecordUnparsable) FROM entities WHERE type = 'unparsable_line')"); constexpr std::array, 1> EXPECTED {{ - {18, "does not parse", true, 1}, + {rollingEntityCounterBase, "does not parse", true, 1}, }}; auto rows = select->as(); BOOST_CHECK_EQUAL_COLLECTIONS(rows.begin(), rows.end(), EXPECTED.begin(), EXPECTED.end()); @@ -553,7 +555,7 @@ BOOST_AUTO_TEST_CASE(RecordUninsertable) FROM entities WHERE type = 'uninsertable_line')"); constexpr std::array, 1> EXPECTED {{ - {21, LOGLINE_UNINSERTABLE, true, 1, + {rollingEntityCounterBase + 3, LOGLINE_UNINSERTABLE, true, 1, "ERROR: invalid input value for enum http_verb: \"CAUSEINSERTFAIL\"\n" "CONTEXT: unnamed portal parameter $5 = '...'\n"}, }}; @@ -657,22 +659,22 @@ using CreateEntitiesData = std::tuple({ - {"host1", WebStat::EntityType::Host, 34}, - {"host2", WebStat::EntityType::Host, 36}, - {"host3", WebStat::EntityType::Host, 38}, - {"host1", WebStat::EntityType::Host, 34}, - {"host2", WebStat::EntityType::Host, 36}, - {"host3", WebStat::EntityType::Host, 38}, - {"host1", WebStat::EntityType::VirtualHost, 43}, - {"host2", WebStat::EntityType::VirtualHost, 45}, - {"host3", WebStat::EntityType::VirtualHost, 47}, - {"host1", WebStat::EntityType::VirtualHost, 43}, - {"host2", WebStat::EntityType::VirtualHost, 45}, - {"host3", WebStat::EntityType::VirtualHost, 47}, - {"host2", WebStat::EntityType::Host, 36}, - {"host1", WebStat::EntityType::VirtualHost, 43}, - {"host3", WebStat::EntityType::Host, 38}, - {"host1", WebStat::EntityType::Host, 34}, + {"host1", WebStat::EntityType::Host, rollingEntityCounterBase + 16}, + {"host2", WebStat::EntityType::Host, rollingEntityCounterBase + 18}, + {"host3", WebStat::EntityType::Host, rollingEntityCounterBase + 20}, + {"host1", WebStat::EntityType::Host, rollingEntityCounterBase + 16}, + {"host2", WebStat::EntityType::Host, rollingEntityCounterBase + 18}, + {"host3", WebStat::EntityType::Host, rollingEntityCounterBase + 20}, + {"host1", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 25}, + {"host2", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 27}, + {"host3", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 29}, + {"host1", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 25}, + {"host2", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 27}, + {"host3", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 29}, + {"host2", WebStat::EntityType::Host, rollingEntityCounterBase + 18}, + {"host1", WebStat::EntityType::VirtualHost, rollingEntityCounterBase + 25}, + {"host3", WebStat::EntityType::Host, rollingEntityCounterBase + 20}, + {"host1", WebStat::EntityType::Host, rollingEntityCounterBase + 16}, }), value, type, expectedId) { -- cgit v1.3