blob: c6f4ccadc68252cdaf92f23a0b3b19fe9b69b9d6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Tests --networkMessageCompressors options.
(function() {
'use strict';
var runTest = function(optionValue, expected) {
jsTest.log("Testing with --networkMessageCompressors=\"" + optionValue + "\" expecting: " +
expected);
var mongo = MongoRunner.runMongod({networkMessageCompressors: optionValue});
assert.commandWorked(mongo.adminCommand({isMaster: 1}));
clearRawMongoProgramOutput();
assert.eq(runMongoProgram("mongo",
"--eval",
"tostrictjson(db.isMaster());",
"--port",
mongo.port,
"--networkMessageCompressors=snappy"),
0);
var output = rawMongoProgramOutput()
.split("\n")
.map(function(str) {
str = str.replace(/^sh[0-9]+\| /, "");
if (!/^{/.test(str)) {
return "";
}
return str;
})
.join("\n")
.trim();
output = JSON.parse(output);
assert.eq(output.compression, expected);
MongoRunner.stopMongod(mongo);
};
assert.isnull(MongoRunner.runMongod({networkMessageCompressors: "snappy,disabled"}));
runTest("snappy", ["snappy"]);
runTest("disabled", undefined);
}());
|