0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/free_mon/free_mon_disable.js
2019-07-27 11:02:23 -04:00

36 lines
748 B
JavaScript

// Validate disable works
//
load("jstests/free_mon/libs/free_mon.js");
(function() {
'use strict';
let mock_web = new FreeMonWebServer();
mock_web.start();
let options = {
setParameter: "cloudFreeMonitoringEndpointURL=" + mock_web.getURL(),
freeMonitoringTag: "foo",
verbose: 1,
};
const conn = MongoRunner.runMongod(options);
assert.neq(null, conn, 'mongod was unable to start up');
assert.commandWorked(conn.adminCommand({setFreeMonitoring: 1, action: "disable"}));
const stats = mock_web.queryStats();
print(tojson(stats));
assert.eq(stats.registers, 0);
assert.eq(FreeMonGetStatus(conn).state, "disabled");
assert.eq(FreeMonGetServerStatus(conn).state, "disabled");
MongoRunner.stopMongod(conn);
mock_web.stop();
})();