Repository navigation
test: strengthen assertions and fix flaky HTTP fixtures - #273
Conversation
Test coverage comparisonCompared base
The production-source comparison adds 75 covered lines with an unchanged denominator. It excludes inline test modules and the two dedicated test-support files. Small test-only seams within production modules remain included. The other metrics are the unfiltered LLVM SDK-source report, so they include inline unit tests. These are not branch-coverage measurements. Coverage is combined across the same four configurations before and after: cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --no-fail-fast --workspace
cargo llvm-cov --no-report --no-fail-fast --features capture-v1
cargo llvm-cov --no-report --no-fail-fast --no-default-features --features error-tracking
cargo llvm-cov --no-report --no-fail-fast --no-default-features --features error-tracking,capture-v1
cargo llvm-cov report --json --output-path coverage.json
cargo llvm-cov report --lcov --output-path coverage.lcov
Counts overlap across configurations and are not unique test totals. Initial instrumentation exposed intermittent TCP fixture failures, which this PR fixes. The final matrix passed after the repairs. Coverage was cleaned and remeasured after restoring all controlled mutations. Doctests were validated separately and are not included in these measurements. Live E2E, external compliance, and Linux-only TLS tests were not executed. Many repairs strengthen assertions on already-covered paths, so their value is not reflected in the coverage increase. |
|
[Low risk] Test improvements and assertion strengthening. The PR appears safe to merge; no outstanding finding or new actionable issue was identified. Reviews (2) · Last reviewed commit: "test: reject unexpected captures in flag..." |
posthog-rs-v0 Compliance ReportDate: 2026-09-27 14:27:55 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
posthog-rs-v1 Compliance ReportDate: 2026-09-27 14:28:08 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
💡 Motivation and Context
Several tests could pass without proving the behavior named in the test. Some counted requests instead of events, checked for no requests before flushing, or treated a dropped V1 batch as successful delivery. The flags test servers also had intermittent failures on macOS because accepted sockets inherited nonblocking mode.
This PR strengthens those assertions and fixes the local HTTP fixtures. Flag-event tests also reject capture requests that do not match the expected batches. It adds process-isolated global client lifecycle tests and checks that panicking error hooks do not prevent later hooks or worker requests. Polling tests now wait for observed requests or callbacks instead of fixed delays. Live E2E tests now check the immediate delivery result rather than only enqueueing an event.
No SDK production behavior or public API changes. No tests were removed.
💚 How did you test it?
917d28dee5b1ee69bbe5bfdb164a652396b8cf05with no findings.Live E2E configurations were compiled but not executed locally. The external compliance harness and Linux-only TLS tests were not run on this macOS host. CI reported 46/46 V0 and 111/111 V1 compliance tests passing for the initial commit.
📝 Checklist
If releasing new changes
sampo addto generate a changeset fileNo release changeset is needed for these test-only changes.