mirror of
https://github.com/nodejs/node.git
synced 2026-10-10 18:59:49 -04:00
test: deflake sliding window histogram test
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: https://github.com/nodejs/node/pull/66132 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
d1960949bb
commit
147ade5ff9
1 file changed
+6
-2
@@ -176,8 +176,12 @@ const {
|
||||
}
|
||||
|
||||
(async () => {
|
||||
// Chunk generations are aligned to the histogram's creation time. Use two
|
||||
// chunks so that a chunk boundary falling between record() and snapshot()
|
||||
// cannot drop the freshly recorded value, and wait for a duration that is
|
||||
// not a multiple of chunkDuration so the wakeup does not land on a boundary.
|
||||
const histogram = createSlidingWindowHistogram({
|
||||
chunks: 1,
|
||||
chunks: 2,
|
||||
chunkDuration: 100,
|
||||
highest: 100,
|
||||
});
|
||||
@@ -185,7 +189,7 @@ const {
|
||||
histogram.record(1);
|
||||
assert.strictEqual(histogram.snapshot().count, 1);
|
||||
|
||||
await delay(common.platformTimeout(200));
|
||||
await delay(common.platformTimeout(250));
|
||||
assert.strictEqual(histogram.snapshot().count, 0);
|
||||
|
||||
histogram.record(2);
|
||||
|
||||
Reference in new issue
Block a user