Files
mongo/jstests/core/opcounters_basic.js
Erin McNulty 7184dd30da SERVER-93699: Remove shell-only testing code from opcounters_active.js (#26319)
GitOrigin-RevId: 694acd84471d3000fb911cf5a993cbc96ed2191e
2024-08-22 14:18:28 +00:00

13 lines
502 B
JavaScript

// Checks that db.serverStatus will not throw errors when metrics tree is not present.
{
const result = db.serverStatus().metrics.commands;
// Test that the metrics.commands.serverStatus value is non-zero
assert.neq(0, db.serverStatus().metrics.commands.serverStatus.total, tojson(result));
}
{
// Test that the command returns successfully when no metrics tree is present
const result = db.serverStatus({"metrics": 0});
assert.eq(undefined, result.metrics, tojson(result));
}