Skip to content

Port LoggingTest improvements from #2087.#2126

Open
Dimi1010 wants to merge 1 commit intoseladb:devfrom
Dimi1010:refactor/logger-test-port-updates
Open

Port LoggingTest improvements from #2087.#2126
Dimi1010 wants to merge 1 commit intoseladb:devfrom
Dimi1010:refactor/logger-test-port-updates

Conversation

@Dimi1010
Copy link
Copy Markdown
Collaborator

@Dimi1010 Dimi1010 commented May 4, 2026

Two main ported improvements from the standalone logger test executable:

  • Replacement of global mock objects with instanced mocks.
  • Improving parameterization of multithreaded test.

Replacement of global mock objects.

This change replaces the global mock singletons LogPrinter and MultiThreadLogCounter with regular instance based mocks. The original reason for the mocks being global singletons no longer applies as the logger callback can be a lambda instead of a raw function pointer. The change allows the mock classes to be simplified.

Improved multithreaded test parameterization.

The old implementation relied on hardcoded 1000 messages per printLogThread call. The new implementation parameterizes that into numMessages parameter, allowing the number to be specified at call time.

The thread count is also now specified at the test call site instead of relying on MultiThreadLogCounter::ThreadCount.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 98.03922% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.68%. Comparing base (36815aa) to head (bf8853f).

Files with missing lines Patch % Lines
Tests/Pcap++Test/Tests/LoggerTests.cpp 98.03% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##              dev    #2126    +/-   ##
========================================
  Coverage   82.68%   82.68%            
========================================
  Files         332      332            
  Lines       59696    59720    +24     
  Branches    12306    12382    +76     
========================================
+ Hits        49359    49380    +21     
- Misses       9014     9477   +463     
+ Partials     1323      863   -460     
Flag Coverage Δ
23.11.6 7.33% <0.00%> (+0.02%) ⬆️
24.11.5 7.34% <0.00%> (-0.01%) ⬇️
25.11.1 7.33% <0.00%> (-0.01%) ⬇️
alpine320 76.77% <72.09%> (-0.03%) ⬇️
fedora42 76.38% <71.42%> (-0.02%) ⬇️
macos-14 82.20% <98.01%> (+<0.01%) ⬆️
macos-15 82.19% <98.01%> (+<0.01%) ⬆️
mingw32 71.00% <ø> (ø)
mingw64 70.98% <ø> (+0.08%) ⬆️
npcap ?
rhel94 76.16% <71.42%> (-0.06%) ⬇️
ubuntu2204 76.18% <71.42%> (-0.06%) ⬇️
ubuntu2204-icpx 59.26% <ø> (-0.04%) ⬇️
ubuntu2404 76.49% <71.42%> (-0.03%) ⬇️
ubuntu2404-arm64 76.48% <72.09%> (-0.04%) ⬇️
ubuntu2604 76.41% <71.42%> (-0.04%) ⬇️
unittest 82.68% <98.03%> (+<0.01%) ⬆️
windows-2022 85.72% <ø> (+0.10%) ⬆️
windows-2025 85.76% <ø> (+0.11%) ⬆️
winpcap 85.76% <ø> (-0.09%) ⬇️
xdp 53.04% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Dimi1010 Dimi1010 marked this pull request as ready for review May 5, 2026 04:07
@Dimi1010 Dimi1010 requested a review from seladb as a code owner May 5, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant