Skip to content

Commit

Permalink
TOOLS-2587: revendor MTC version 4.0.4 and fix qa-tests (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan-Mongo committed Aug 19, 2020
1 parent cd4a54b commit 8c1800b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 38 deletions.
6 changes: 3 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ required = ["github.com/3rf/mongo-lint"]

[[constraint]]
name = "github.com/mongodb/mongo-tools-common"
version = "v4.0.3"
version = "v4.0.4"

[[constraint]]
name = "github.com/nsf/termbox-go"
Expand Down
46 changes: 23 additions & 23 deletions test/qa-tests/jstests/stat/stat_custom_headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-o", "host,conn,time", "-n", 4, "--humanReadable=false"].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
assert.eq.soon(5, function() {
assert.eq.soon(6, function() {
rows = allShellRows();
return rows.length;
}, "expected 5 rows in mongostat output");
assert.eq(statFields(rows[0]).join(), "host,conn,time",
"first row doesn't match 'host conn time'");
assert.eq(statFields(rows[1]).length, 3,
}, "expected 6 rows in mongostat output");
assert.eq(statFields(rows[1]).join(), "host,conn,time",
"second row doesn't match 'host conn time'");
assert.eq(statFields(rows[2]).length, 3,
"there should be exactly three entries for a row of this stat output");
clearRawMongoProgramOutput();

// basic -o
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-o", "host,conn,time", "-n", 4].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
assert.eq.soon(5, function() {
assert.eq.soon(6, function() {
rows = allShellRows();
return rows.length;
}, "expected 5 rows in mongostat output");
assert.eq(statFields(rows[0]).join(), "host,conn,time",
"first row doesn't match 'host conn time'");
assert.eq(statFields(rows[1]).length, 5,
"there should be exactly five entries for a row of this stat output (time counts as three)");
}, "expected 6 rows in mongostat output");
assert.eq(statFields(rows[1]).join(), "host,conn,time",
"second row doesn't match 'host conn time'");
assert.eq(statFields(rows[2]).length, 5,
"third row should have exactly five entries (time counts as three)");
clearRawMongoProgramOutput();

// basic -O
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-O", "host", "-n", 4].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
rows = allShellRows();
var fields = statFields(rows[0]);
var fields = statFields(rows[1]);
assert.eq(fields[fields.length-1], "host",
"first row should end with added 'host' field");
clearRawMongoProgramOutput();
Expand All @@ -58,27 +58,27 @@
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-o", "host=H,conn=C,time=MYTiME", "-n", 4].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
assert.eq.soon(5, function() {
assert.eq.soon(6, function() {
rows = allShellRows();
return rows.length;
}, "expected 5 rows in mongostat output");
assert.eq(statFields(rows[0]).join(), "H,C,MYTiME",
}, "expected 6 rows in mongostat output");
assert.eq(statFields(rows[1]).join(), "H,C,MYTiME",
"first row doesn't match 'H C MYTiME'");
assert.eq(statFields(rows[1]).length, 5,
assert.eq(statFields(rows[2]).length, 5,
"there should be exactly five entries for a row of this stat output (time counts as three)");
clearRawMongoProgramOutput();

// serverStatus custom field
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-o", "host,conn,mem.bits", "-n", 4].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
assert.eq.soon(5, function() {
assert.eq.soon(6, function() {
rows = allShellRows();
return rows.length;
}, "expected 5 rows in mongostat output");
assert.eq(statFields(rows[0]).join(), "host,conn,mem.bits",
}, "expected 6 rows in mongostat output");
assert.eq(statFields(rows[1]).join(), "host,conn,mem.bits",
"first row doesn't match 'host time mem.bits'");
fields = statFields(rows[1]);
fields = statFields(rows[2]);
assert.eq(fields.length, 3,
"there should be exactly three entries for a row of this stat output");
assert(fields[2] === "32" || fields[2] === "64",
Expand All @@ -90,13 +90,13 @@
x = runMongoProgram.apply(this, ["mongostat", "--port", port,
"-o", "host,conn=MYCoNN,mem.bits=BiTs", "-n", 4].concat(commonToolArgs));
assert.eq(x, 0, "mongostat should succeed with -o and -n options");
assert.eq.soon(5, function() {
assert.eq.soon(6, function() {
rows = allShellRows();
return rows.length;
}, "expected 5 rows in mongostat output");
assert.eq(statFields(rows[0]).join(), "host,MYCoNN,BiTs",
assert.eq(statFields(rows[1]).join(), "host,MYCoNN,BiTs",
"first row doesn't match 'host MYTiME BiTs'");
fields = statFields(rows[1]);
fields = statFields(rows[2]);
assert.eq(fields.length, 3,
"there should be exactly three entries for a row of this stat output");
assert(fields[2] === "32" || fields[2] === "64",
Expand Down
6 changes: 3 additions & 3 deletions test/qa-tests/jstests/top/mongotop_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var testName = 'mongotop_json';
.concat(passthrough.args)
.concat(sslOptions));
assert.eq(ret.exitCode, 0, 'failed 2');
assert.eq.soon(rowcount, function() {
assert.eq.soon(rowcount + 1, function() {
return ret.getOutput().split('\n').length;
}, "expected " + rowcount + " top results");
ret.getOutput().split('\n').forEach(function(line) {
}, "expected " + (rowcount + 1) + " top results");
ret.getOutput().split('\n').slice(1).forEach(function(line) {
assert(typeof JSON.parse(extractJSON(line)) === 'object', 'invalid JSON 2');
});

Expand Down
4 changes: 2 additions & 2 deletions test/qa-tests/jstests/top/mongotop_sharded.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ var testName = 'mongotop_sharded';
assert.strContains.soon(expectedError, getOutput, 'error message must appear at least once');
var shellOutput = getOutput();
jsTest.log('shell output: ' + shellOutput);
shellOutput.split('\n').forEach(function(line) {
shellOutput.split('\n').slice(1).forEach(function(line) {
// check the displayed error message
assert.neq(line.match(expectedError), null, 'unexpeced error message');
assert.neq(line.match(expectedError), null, 'unexpected error message');
});
};

Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/mongodb/mongo-tools-common/db/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions vendor/github.com/mongodb/mongo-tools-common/options/options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8c1800b

Please sign in to comment.