Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,12 @@ test("getCgroupCpuCountFromCpus returns undefined if the CPU file exists but is
);
});
});

test("checkDiskUsage succeeds and produces positive numbers", async (t) => {
const diskUsage = await util.checkDiskUsage(getRunnerLogger(true));
t.true(
diskUsage?.numAvailableBytes !== undefined &&
diskUsage.numAvailableBytes > 0,
);
t.true(diskUsage?.numTotalBytes !== undefined && diskUsage.numTotalBytes > 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but I quite like t.truthy in an if condition that guards the check on the property. The && makes it harder to debug which sub-condition failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to write because we can't compare undefined with 0. I'll make two separate assertions.

});
Loading