mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 10:30:22 +00:00
test(telemetry): assert the nodestore_state labels and pin writer depth
The 22 metric label values on the nodestore_state gauge were asserted nowhere, and the depthSum assertions could not tell the real fetch_add(depth) from a fetch_add(1) that would silently zero every derived queueing time. Make the four observe* helpers and their ObserveFn sink public rather than private, so the seam the header already claimed is actually reachable. All four are static and read only their arguments, so this exposes no object state; a friend declaration would have granted access to every private member instead. The assertions live in the existing Beast nodestore suite because src/test compiles into xrpld, which contains MetricsRegistry.cpp, while xrpl_tests deliberately does not when telemetry is enabled. Each helper now has its exact emitted label set asserted, so a typo in any literal fails instead of silently producing a disjoint series, and each derived mean is asserted ABSENT on a fresh store -- a refactor to value_or(0) would draw a believable flat zero on a latency axis and otherwise pass everything. Replace the concurrent write-stats test with one that forces genuine overlap through a latch. NuDB holds one global mutex for the whole insert and doInsert reads the depth before entering it, so a blocked thread records a depth of at least 2; asserting depthSum strictly exceeds insertCount therefore cannot be satisfied by a constant 1. The old bounds admitted that bug at their floor. Also: cover the std::nullopt branch on the two backends that exist in every build, bound the store-duration accumulator by the wall clock, drop four assertions that cannot fail, and correct two comments that claimed coverage the tests do not have -- the duplicate-key test is not the throwing path, because nudb reports key_exists without throwing, and no test drives NodeStoreScheduler::onFetch.
This commit is contained in:
@@ -138,7 +138,9 @@ test.nodestore > test.jtx
|
||||
test.nodestore > test.unit_test
|
||||
test.nodestore > xrpl.basics
|
||||
test.nodestore > xrpl.config
|
||||
test.nodestore > xrpld.app
|
||||
test.nodestore > xrpld.core
|
||||
test.nodestore > xrpld.telemetry
|
||||
test.nodestore > xrpl.nodestore
|
||||
test.nodestore > xrpl.rdb
|
||||
test.overlay > test.jtx
|
||||
|
||||
Reference in New Issue
Block a user