diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2015-02-03 08:10:52 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2015-02-03 13:52:38 -0500 |
commit | 67b1c6da115b8809752a9b966eed2e9fbeb21db3 (patch) | |
tree | 7df4104c62f5ab6e4238453ed411fbb1486ceb9e /jstests | |
parent | 78a0cc02d5868ea3d03ae104dce6b2908fb63e59 (diff) | |
download | mongo-67b1c6da115b8809752a9b966eed2e9fbeb21db3.tar.gz |
SERVER-16792: fix smoke.py --small-oplog-rs so it works
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/ismaster.js | 30 | ||||
-rw-r--r-- | jstests/core/write_result.js | 14 |
2 files changed, 25 insertions, 19 deletions
diff --git a/jstests/core/ismaster.js b/jstests/core/ismaster.js index 0c385b02d7c..cae8c848044 100644 --- a/jstests/core/ismaster.js +++ b/jstests/core/ismaster.js @@ -11,18 +11,22 @@ assert( res.maxWriteBatchSize && res.maxWriteBatchSize > 0, "maxWriteBatchSize possibly missing:" + tojson(res)); assert(res.ismaster, "ismaster missing or false:" + tojson(res)); assert(res.localTime, "localTime possibly missing:" + tojson(res)); -var unwantedFields = ["setName", "setVersion", "secondary", "hosts", "passives", "arbiters", - "primary", "aribterOnly", "passive", "slaveDelay", "hidden", "tags", - "buildIndexes", "me"]; -// check that the fields that shouldn't be there are not there -var badFields = []; -for (field in res) { - if (!res.hasOwnProperty(field)){ - continue; - } - if (Array.contains(unwantedFields, field)) { - badFields.push(field); + + +if (!testingReplication) { + var badFields = []; + var unwantedReplSetFields = ["setName", "setVersion", "secondary", "hosts", "passives", + "arbiters", "primary", "aribterOnly", "passive", + "slaveDelay", "hidden", "tags", "buildIndexes", "me"]; + // check that the fields that shouldn't be there are not there + for (field in res) { + if (!res.hasOwnProperty(field)) { + continue; + } + if (Array.contains(unwantedReplSetFields, field)) { + badFields.push(field); + } } + assert(badFields.length === 0, "\nthe result:\n" + tojson(res) + + "\ncontained fields it shouldn't have: " + badFields); } -assert(badFields.length === 0, "\nthe result:\n" + tojson(res) - + "\ncontained fields it shouldn't have: " + badFields); diff --git a/jstests/core/write_result.js b/jstests/core/write_result.js index 1a2161873b2..95c298c165a 100644 --- a/jstests/core/write_result.js +++ b/jstests/core/write_result.js @@ -172,13 +172,15 @@ coll.unsetWriteConcern(); // // Write concern error -// NOTE: Non-throwing write concern failures require replication to trigger +// NOTE: In a replica set write concern is checked after write coll.remove({}); -assert.writeError( coll.insert({ foo : "bar" }, { writeConcern : { w : "invalid" } }) ); -if (coll.getMongo().writeMode() == "commands") - assert.eq(coll.count(), 0); -else - assert.eq(coll.count(), 1); +var wRes = assert.writeError( coll.insert({ foo : "bar" }, { writeConcern : { w : "invalid" } }) ); +var res = assert.commandWorked(db.isMaster()); +var replSet = res.hasOwnProperty("setName"); +if (!replSet && coll.getMongo().writeMode() == "commands") + assert.eq(coll.count(), 0, "not-replset || command mode"); +else // compatibility, + assert.eq(coll.count(), 1, "replset || non-command mode"); |