summaryrefslogtreecommitdiff
path: root/jstests/auth
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2019-01-25 12:54:45 -0500
committerJason Carey <jcarey@argv.me>2019-02-04 14:49:52 -0500
commit8c157f05ea25f13595734b03b3c5b55cd16d7cd6 (patch)
tree27cbb691e3cf0dbc014be24eccbbae6f4f269280 /jstests/auth
parent1b1cf52e94c49ca4c6d8ba693e949c2b655e74b5 (diff)
downloadmongo-8c157f05ea25f13595734b03b3c5b55cd16d7cd6.tar.gz
SERVER-37823 Server Side Traffic Capture
Adds support for special commands which dump wire protocol traffic to disk.
Diffstat (limited to 'jstests/auth')
-rw-r--r--jstests/auth/commands_builtin_roles.js14
-rw-r--r--jstests/auth/lib/commands_lib.js24
2 files changed, 35 insertions, 3 deletions
diff --git a/jstests/auth/commands_builtin_roles.js b/jstests/auth/commands_builtin_roles.js
index f309435d6d6..32674cd8a41 100644
--- a/jstests/auth/commands_builtin_roles.js
+++ b/jstests/auth/commands_builtin_roles.js
@@ -143,7 +143,13 @@ function checkForNonExistentRoles() {
}
}
-var opts = {auth: "", enableExperimentalStorageDetailsCmd: ""};
+const dbPath = MongoRunner.toRealDir("$dataDir/commands_built_in_roles/");
+mkdir(dbPath);
+var opts = {
+ auth: "",
+ enableExperimentalStorageDetailsCmd: "",
+ setParameter: "trafficRecordingDirectory=" + dbPath
+};
var impls = {createUsers: createUsers, runOneTest: runOneTest};
checkForNonExistentRoles();
@@ -159,7 +165,11 @@ conn = new ShardingTest({
shards: 2,
mongos: 1,
keyFile: "jstests/libs/key1",
- other: {shardOptions: opts, shardAsReplicaSet: false}
+ other: {
+ shardOptions: opts,
+ shardAsReplicaSet: false,
+ mongosOptions: {setParameter: "trafficRecordingDirectory=" + dbPath}
+ }
});
authCommandsLib.runTests(conn, impls);
conn.stop();
diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js
index 6899d0646aa..99b6d9a6924 100644
--- a/jstests/auth/lib/commands_lib.js
+++ b/jstests/auth/lib/commands_lib.js
@@ -5972,7 +5972,29 @@ var authCommandsLib = {
{killCursors: "$cmd.aggregate", cursors: [response.cursor.id]}));
}
}
- }
+ },
+ {
+ testname: "startRecordingTraffic",
+ command: {startRecordingTraffic: 1, filename: "notARealPath"},
+ testcases: [
+ {runOnDb: adminDbName, roles: roles_hostManager},
+ ],
+ teardown: (db, response) => {
+ if (response.ok) {
+ assert.commandWorked(db.runCommand({stopRecordingTraffic: 1}));
+ }
+ }
+ },
+ {
+ testname: "stopRecordingTraffic",
+ command: {stopRecordingTraffic: 1},
+ testcases: [
+ {runOnDb: adminDbName, roles: roles_hostManager},
+ ],
+ setup: function(db) {
+ db.runCommand({startRecordingTraffic: 1, filename: "notARealPath"});
+ }
+ },
],
/************* SHARED TEST LOGIC ****************/