Skip to content

Commit cd8b5fa

Browse files
RafaelGSSrichardlau
authored andcommitted
test: tolerate async block count updates in test-fs-stat-bigint
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #66576 Refs: #57797 Refs: nodejs/reliability#1657 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parent 714aca1 commit cd8b5fa

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎test/parallel/test-fs-stat-bigint.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ function verifyStats(bigintStats, numStats, allowableDelta) {
7878
`Number version ${key} = ${msFromNum}, ` +
7979
`BigInt version ${nsKey} = ${nsFromBigInt}n` +
8080
` = ${msFromBigIntNs}ms, Allowable delta = ${allowableDelta}`);
81+
} else if (key === 'blocks') {
82+
// Some file systems (e.g. ZFS on SmartOS) update the block count of a
83+
// freshly written file asynchronously, so it can change between the
84+
// two stat() calls.
85+
assert.strictEqual(typeof bigintStats[key], 'bigint');
86+
assert(bigintStats[key] >= 0n);
8187
} else if (Number.isSafeInteger(val)) {
8288
assert.strictEqual(
8389
bigintStats[key], BigInt(val),

0 commit comments

Comments
 (0)