summaryrefslogtreecommitdiff
path: root/jstests/watchdog
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/watchdog
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/watchdog')
-rw-r--r--jstests/watchdog/lib/charybdefs_lib.js2
-rw-r--r--jstests/watchdog/wd_auditpath_hang.js21
-rw-r--r--jstests/watchdog/wd_dbpath_hang.js9
-rw-r--r--jstests/watchdog/wd_journal_hang.js34
-rw-r--r--jstests/watchdog/wd_logpath_hang.js9
-rw-r--r--jstests/watchdog/wd_setparam.js85
6 files changed, 77 insertions, 83 deletions
diff --git a/jstests/watchdog/lib/charybdefs_lib.js b/jstests/watchdog/lib/charybdefs_lib.js
index f80246426d8..bd0d7440e0d 100644
--- a/jstests/watchdog/lib/charybdefs_lib.js
+++ b/jstests/watchdog/lib/charybdefs_lib.js
@@ -94,7 +94,6 @@ function CharybdefsControl(test_name) {
// Wait for watchdog to stop
print("Waiting for MongoDB to hang.");
sleep(fs_delay_sec * 1000);
-
};
/**
@@ -105,7 +104,6 @@ function CharybdefsControl(test_name) {
* @param {number} delay_us - optional delay in microseconds to wait
*/
this.addFault = function(method, file_name, delay_us) {
-
this._runControl("set_fault",
"--methods=" + method,
"--errno=5",
diff --git a/jstests/watchdog/wd_auditpath_hang.js b/jstests/watchdog/wd_auditpath_hang.js
index bd961d55a47..bca58b1f501 100644
--- a/jstests/watchdog/wd_auditpath_hang.js
+++ b/jstests/watchdog/wd_auditpath_hang.js
@@ -3,19 +3,18 @@
load("jstests/watchdog/lib/wd_test_common.js");
(function() {
- 'use strict';
+'use strict';
- if (assert.commandWorked(db.runCommand({buildInfo: 1})).modules.includes("enterprise")) {
- let control = new CharybdefsControl("auditpath_hang");
+if (assert.commandWorked(db.runCommand({buildInfo: 1})).modules.includes("enterprise")) {
+ let control = new CharybdefsControl("auditpath_hang");
- const auditPath = control.getMountPath();
+ const auditPath = control.getMountPath();
- testFuseAndMongoD(control, {
-
- auditDestination: 'file',
- auditFormat: 'JSON',
- auditPath: auditPath + "/auditLog.json"
- });
- }
+ testFuseAndMongoD(control, {
+ auditDestination: 'file',
+ auditFormat: 'JSON',
+ auditPath: auditPath + "/auditLog.json"
+ });
+}
})();
diff --git a/jstests/watchdog/wd_dbpath_hang.js b/jstests/watchdog/wd_dbpath_hang.js
index 39147fe2229..f0c2060294a 100644
--- a/jstests/watchdog/wd_dbpath_hang.js
+++ b/jstests/watchdog/wd_dbpath_hang.js
@@ -3,12 +3,11 @@
load("jstests/watchdog/lib/wd_test_common.js");
(function() {
- 'use strict';
+'use strict';
- let control = new CharybdefsControl("dbpath_hang");
+let control = new CharybdefsControl("dbpath_hang");
- const dbPath = control.getMountPath() + "/db";
-
- testFuseAndMongoD(control, {dbpath: dbPath});
+const dbPath = control.getMountPath() + "/db";
+testFuseAndMongoD(control, {dbpath: dbPath});
})();
diff --git a/jstests/watchdog/wd_journal_hang.js b/jstests/watchdog/wd_journal_hang.js
index c07b4298170..e33931cf5dd 100644
--- a/jstests/watchdog/wd_journal_hang.js
+++ b/jstests/watchdog/wd_journal_hang.js
@@ -4,30 +4,30 @@
load("jstests/watchdog/lib/wd_test_common.js");
(function() {
- 'use strict';
+'use strict';
- function trimTrailingSlash(dir) {
- if (dir.endsWith('/')) {
- return dir.substring(0, dir.length - 1);
- }
-
- return dir;
+function trimTrailingSlash(dir) {
+ if (dir.endsWith('/')) {
+ return dir.substring(0, dir.length - 1);
}
- let control = new CharybdefsControl("journalpath_hang");
+ return dir;
+}
+
+let control = new CharybdefsControl("journalpath_hang");
- const journalFusePath = control.getMountPath();
+const journalFusePath = control.getMountPath();
- const dbPath = MongoRunner.toRealDir("$dataDir/mongod-journal");
+const dbPath = MongoRunner.toRealDir("$dataDir/mongod-journal");
- const journalLinkPath = dbPath + "/journal";
+const journalLinkPath = dbPath + "/journal";
- resetDbpath(dbPath);
+resetDbpath(dbPath);
- // Create a symlink from the non-fuse journal directory to the fuse mount.
- const ret = run("ln", "-s", trimTrailingSlash(journalFusePath), journalLinkPath);
- assert.eq(ret, 0);
+// Create a symlink from the non-fuse journal directory to the fuse mount.
+const ret = run("ln", "-s", trimTrailingSlash(journalFusePath), journalLinkPath);
+assert.eq(ret, 0);
- // Set noCleanData so that the dbPath is not cleaned because we want to use the journal symlink.
- testFuseAndMongoD(control, {dbpath: dbPath, noCleanData: true});
+// Set noCleanData so that the dbPath is not cleaned because we want to use the journal symlink.
+testFuseAndMongoD(control, {dbpath: dbPath, noCleanData: true});
})();
diff --git a/jstests/watchdog/wd_logpath_hang.js b/jstests/watchdog/wd_logpath_hang.js
index 9a3ec13c845..598cb286f3d 100644
--- a/jstests/watchdog/wd_logpath_hang.js
+++ b/jstests/watchdog/wd_logpath_hang.js
@@ -3,12 +3,11 @@
load("jstests/watchdog/lib/wd_test_common.js");
(function() {
- 'use strict';
+'use strict';
- let control = new CharybdefsControl("logpath_hang");
+let control = new CharybdefsControl("logpath_hang");
- const logpath = control.getMountPath();
-
- testFuseAndMongoD(control, {logpath: logpath + "/foo.log"});
+const logpath = control.getMountPath();
+testFuseAndMongoD(control, {logpath: logpath + "/foo.log"});
})();
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);
})();