summaryrefslogtreecommitdiff
path: root/jstests/watchdog/wd_setparam.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/watchdog/wd_setparam.js')
-rw-r--r--jstests/watchdog/wd_setparam.js85
1 files changed, 42 insertions, 43 deletions
diff --git a/jstests/watchdog/wd_setparam.js b/jstests/watchdog/wd_setparam.js
index 0857e11b1ff..cc74b96ef0c 100644
--- a/jstests/watchdog/wd_setparam.js
+++ b/jstests/watchdog/wd_setparam.js
@@ -1,60 +1,59 @@
// Storage Node Watchdog test cases
// - Validate set parameter functions correctly.
(function() {
- 'use strict';
- const admin = db.getSiblingDB("admin");
+'use strict';
+const admin = db.getSiblingDB("admin");
- // Check the defaults are correct
- //
- function getparam(adminDb, field) {
- let q = {getParameter: 1};
- q[field] = 1;
+// Check the defaults are correct
+//
+function getparam(adminDb, field) {
+ let q = {getParameter: 1};
+ q[field] = 1;
- const ret = adminDb.runCommand(q);
- return ret[field];
- }
+ const ret = adminDb.runCommand(q);
+ return ret[field];
+}
- // Verify the defaults are as we documented them
- assert.eq(getparam(admin, "watchdogPeriodSeconds"), -1);
+// Verify the defaults are as we documented them
+assert.eq(getparam(admin, "watchdogPeriodSeconds"), -1);
- function setparam(adminDb, obj) {
- const ret = adminDb.runCommand(Object.extend({setParameter: 1}, obj));
- return ret;
- }
+function setparam(adminDb, obj) {
+ const ret = adminDb.runCommand(Object.extend({setParameter: 1}, obj));
+ return ret;
+}
- // Negative tests
- // Negative: set it too low.
- assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 1}));
- // Negative: set it the min value but fail since it was not enabled.
- assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 60}));
- // Negative: set it the min value + 1 but fail since it was not enabled.
- assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 61}));
+// Negative tests
+// Negative: set it too low.
+assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 1}));
+// Negative: set it the min value but fail since it was not enabled.
+assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 60}));
+// Negative: set it the min value + 1 but fail since it was not enabled.
+assert.commandFailed(setparam(admin, {"watchdogPeriodSeconds": 61}));
- // Now test MongoD with it enabled at startup
- //
- const conn = MongoRunner.runMongod({setParameter: "watchdogPeriodSeconds=60"});
- assert.neq(null, conn, 'mongod was unable to start up');
+// Now test MongoD with it enabled at startup
+//
+const conn = MongoRunner.runMongod({setParameter: "watchdogPeriodSeconds=60"});
+assert.neq(null, conn, 'mongod was unable to start up');
- const admin2 = conn.getDB("admin");
+const admin2 = conn.getDB("admin");
- // Validate defaults
- assert.eq(getparam(admin2, "watchdogPeriodSeconds"), 60);
+// Validate defaults
+assert.eq(getparam(admin2, "watchdogPeriodSeconds"), 60);
- // Negative: set it too low.
- assert.commandFailed(setparam(admin2, {"watchdogPeriodSeconds": 1}));
- // Positive: set it the min value
- assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 60}));
- // Positive: set it the min value + 1
- assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 61}));
+// Negative: set it too low.
+assert.commandFailed(setparam(admin2, {"watchdogPeriodSeconds": 1}));
+// Positive: set it the min value
+assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 60}));
+// Positive: set it the min value + 1
+assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 61}));
- // Positive: disable it
- assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": -1}));
+// Positive: disable it
+assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": -1}));
- assert.eq(getparam(admin2, "watchdogPeriodSeconds"), -1);
+assert.eq(getparam(admin2, "watchdogPeriodSeconds"), -1);
- // Positive: enable it again
- assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 60}));
-
- MongoRunner.stopMongod(conn);
+// Positive: enable it again
+assert.commandWorked(setparam(admin2, {"watchdogPeriodSeconds": 60}));
+MongoRunner.stopMongod(conn);
})();