0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/replsets/initiate.js
Charlie Swanson 8d27279d6f SERVER-16405 Expand replication command tests.
Closes #881

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-12-12 17:05:20 -05:00

26 lines
818 B
JavaScript

/*
* Sanity check that initializing will fail with bad input. There are C++ unit tests for most bad
* configs, so this is just seeing if it fails when it's supposed to.
*/
(function () {
"use strict";
var replTest = new ReplSetTest({name : 'testSet2', nodes : 1});
var nodes = replTest.startSet();
assert.soon(function() {
try {
var result = nodes[0].getDB("admin").runCommand(
{replSetInitiate: {_id: "testSet2", members: [{_id : 0, tags : ["member0"]}]}});
printjson(result);
return (result.errmsg.match(/bad or missing host field/) ||
result.errmsg.match(/Missing expected field \"host\"/));
}
catch (e) {
print(e);
}
return false;
});
replTest.stopSet();
}());