Skip to content
Merged
Changes from all commits
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
12 changes: 7 additions & 5 deletions test/metrics/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ test('reports expected metrics', function (t) {
},
'system.memory.actual.free': (value) => {
const free = os.freemem()
if (os.type() === 'Linux' && semver.lt(process.version, '18.0.0-nightly20220107')) {
if (os.type() === 'Linux' &&
semver.lt(process.version, '18.0.0-nightly20220107') &&
semver.lt(process.version, '17.4.0')) {
// On Linux we use "MemAvailable" from /proc/meminfo as the value for
// this metric. In versions of Node.js before v18.0.0, `os.freemem()`
// reports "MemFree" from /proc/meminfo. (This changed in
// v18.0.0-nightly20220107b6b6510187 when node upgraded to libuv
// 1.43.0 to include https://github.com/libuv/libuv/pull/3351.)
// this metric. In versions of Node.js before v17.4.0 and v18.0.0,
// `os.freemem()` reports "MemFree" from /proc/meminfo. (This changed
// in v17.4.0 and v18.0.0-nightly20220107b6b6510187 when node upgraded
// to libuv 1.43.0 to include https://github.com/libuv/libuv/pull/3351.)
t.ok(value > free, `is larger than os.freemem() (value: ${value},
free: ${free})`)
} else {
Expand Down