summaryrefslogtreecommitdiff
path: root/jstests/free_mon
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2018-05-21 16:46:51 -0400
committerSara Golemon <sara.golemon@mongodb.com>2018-05-30 08:17:28 -0400
commit774af67d1d2115d9a89a45643b42e931bec9aa82 (patch)
tree45cc82d747c448a58bf8ece266fec7be3a05f0e7 /jstests/free_mon
parent39694ed5ee47848c3e51f8b739e9ccad8ca54c69 (diff)
downloadmongo-774af67d1d2115d9a89a45643b42e931bec9aa82.tar.gz
SERVER-35022 Check if Free Monitoring is enabled during transition to primary
Diffstat (limited to 'jstests/free_mon')
-rw-r--r--jstests/free_mon/free_mon_register_cmd.js9
-rw-r--r--jstests/free_mon/free_mon_rs_register.js5
2 files changed, 13 insertions, 1 deletions
diff --git a/jstests/free_mon/free_mon_register_cmd.js b/jstests/free_mon/free_mon_register_cmd.js
index d3d6dae12d4..6eb0c1f9c69 100644
--- a/jstests/free_mon/free_mon_register_cmd.js
+++ b/jstests/free_mon/free_mon_register_cmd.js
@@ -17,6 +17,15 @@ load("jstests/free_mon/libs/free_mon.js");
const conn = MongoRunner.runMongod(options);
assert.neq(null, conn, 'mongod was unable to start up');
+ // Wait an arbitrary amount of time to allow the processor loop to start.
+ sleep(10 * 1000);
+
+ // Then verify that no registrations happened since we haven't runtime enabled yed.
+ assert.eq('undecided',
+ conn.getDB('admin').getFreeMonitoringStatus().state,
+ "Initial state should be 'undecided'");
+ assert.eq(0, mock_web.queryStats().registers, "mongod registered without enabling free_mod");
+
assert.commandWorked(conn.adminCommand({setFreeMonitoring: 1, action: "enable"}));
// The command should either timeout or suceed after registration is complete
diff --git a/jstests/free_mon/free_mon_rs_register.js b/jstests/free_mon/free_mon_rs_register.js
index 65577d59d98..9002e3e3793 100644
--- a/jstests/free_mon/free_mon_rs_register.js
+++ b/jstests/free_mon/free_mon_rs_register.js
@@ -11,7 +11,6 @@ load("jstests/free_mon/libs/free_mon.js");
let options = {
setParameter: "cloudFreeMonitoringEndpointURL=" + mock_web.getURL(),
- enableFreeMonitoring: "on",
verbose: 1,
};
@@ -20,6 +19,10 @@ load("jstests/free_mon/libs/free_mon.js");
rst.initiate();
rst.awaitReplication();
+ sleep(10 * 1000);
+ assert.eq(0, mock_web.queryStats().registers, "mongod registered without enabling free_mod");
+
+ assert.commandWorked(rst.getPrimary().adminCommand({setFreeMonitoring: 1, action: "enable"}));
WaitForRegistration(rst.getPrimary());
mock_web.waitRegisters(2);