summaryrefslogtreecommitdiff
path: root/jstests/free_mon
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2018-08-27 14:26:01 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2018-08-27 14:26:27 -0400
commit402fa5cc4a5f74cd7e592d9273a94e7cf25446b6 (patch)
tree9e8d3927df8a59224b027111c1ef26e7692368be /jstests/free_mon
parent57d007e00124d18e94c204e3968b53f83c01f1b7 (diff)
downloadmongo-402fa5cc4a5f74cd7e592d9273a94e7cf25446b6.tar.gz
SERVER-36474 Cannot initiate a replica set if free monitoring is disabled at command-line
Diffstat (limited to 'jstests/free_mon')
-rw-r--r--jstests/free_mon/free_mon_rs_off.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/jstests/free_mon/free_mon_rs_off.js b/jstests/free_mon/free_mon_rs_off.js
new file mode 100644
index 00000000000..a15519bd2ac
--- /dev/null
+++ b/jstests/free_mon/free_mon_rs_off.js
@@ -0,0 +1,38 @@
+// Validate replica set starts up with free monitoring disabled
+//
+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(),
+ enableFreeMonitoring: "off",
+ verbose: 1,
+ };
+
+ const rst = new ReplSetTest({nodes: 2, nodeOptions: options});
+
+ rst.startSet();
+ rst.initiate();
+ rst.awaitReplication();
+
+ const retStatus1 = rst.getPrimary().adminCommand({getFreeMonitoringStatus: 1});
+ assert.commandWorked(retStatus1);
+ assert.eq(retStatus1.state, "disabled", tojson(retStatus1));
+
+ const stats = mock_web.queryStats();
+ print(tojson(stats));
+
+ assert.eq(stats.registers, 0);
+
+ assert.commandFailed(rst.getPrimary().adminCommand({setFreeMonitoring: 1, action: "disable"}));
+
+ rst.stopSet();
+
+ mock_web.stop();
+})();