summaryrefslogtreecommitdiff
path: root/jstests/resmoke_selftest
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@mongodb.com>2020-01-24 14:37:15 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-01-31 23:21:38 +0000
commit109047bc5402ffe2b2ada07e677e9699cd74a76e (patch)
tree1e03f8ff8e841c0bc27c4c89afbf743221a426dc /jstests/resmoke_selftest
parentf4f87e2b3f04172974b00eb1fb8666c787c05a12 (diff)
downloadmongo-109047bc5402ffe2b2ada07e677e9699cd74a76e.tar.gz
SERVER-45377 add global option to enable and disable shell hang analyzer
Diffstat (limited to 'jstests/resmoke_selftest')
-rw-r--r--jstests/resmoke_selftest/shell_hang_analyzer.js41
1 files changed, 32 insertions, 9 deletions
diff --git a/jstests/resmoke_selftest/shell_hang_analyzer.js b/jstests/resmoke_selftest/shell_hang_analyzer.js
index db8e02b53e9..bea1c5714a3 100644
--- a/jstests/resmoke_selftest/shell_hang_analyzer.js
+++ b/jstests/resmoke_selftest/shell_hang_analyzer.js
@@ -1,4 +1,14 @@
'use strict';
+(function() {
+
+const anyLineMatches = function(lines, rex) {
+ for (const line of lines) {
+ if (line.match(rex)) {
+ return true;
+ }
+ }
+ return false;
+};
(function() {
@@ -8,21 +18,19 @@
const child = MongoRunner.runMongod();
try {
- MongoRunner.runHangAnalyzer([child.pid]);
+ clearRawMongoProgramOutput();
- const anyLineMatches = function(lines, rex) {
- for (const line of lines) {
- if (line.match(rex)) {
- return true;
- }
- }
- return false;
- };
+ // drive-by test for enable(). Separate test for disable() below.
+ MongoRunner.runHangAnalyzer.disable();
+ MongoRunner.runHangAnalyzer.enable();
+
+ MongoRunner.runHangAnalyzer([child.pid]);
assert.soon(() => {
const lines = rawMongoProgramOutput().split('\n');
return anyLineMatches(lines, /Dumping core/);
});
+
} finally {
MongoRunner.stopMongod(child);
}
@@ -39,3 +47,18 @@ assert(typeof TestData.peerPids !== 'undefined');
// ShardedClusterFixture 2 shards with 3 rs members per shard, 2 mongos's => 7 peers
assert.eq(7, TestData.peerPids.length);
})();
+
+(function() {
+/*
+ * Test MongoRunner.runHangAnalzyzer.disable()
+ */
+clearRawMongoProgramOutput();
+
+MongoRunner.runHangAnalyzer.disable();
+MongoRunner.runHangAnalyzer([20200125]);
+
+const lines = rawMongoProgramOutput().split('\n');
+// Nothing should be executed, so there's no output.
+assert.eq(lines, ['']);
+})();
+})();