diff options
author | Spencer T Brody <spencer@10gen.com> | 2013-01-29 19:17:16 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2013-02-07 13:56:19 -0500 |
commit | 5850b2b5aacfe391a0ec34cac0e60d224aa442b2 (patch) | |
tree | 8f3c07ac539b3d80756641f2cae039878fc0ea8f /jstests | |
parent | 13dc58eee6fc66b903dd8a65d6dc9537beaf8067 (diff) | |
download | mongo-5850b2b5aacfe391a0ec34cac0e60d224aa442b2.tar.gz |
Make read_pref.js more resilient to transient network errors after a replSetReconfig
Diffstat (limited to 'jstests')
-rwxr-xr-x | jstests/sharding/read_pref.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/jstests/sharding/read_pref.js b/jstests/sharding/read_pref.js index fd69f890836..e83ff4ca028 100755 --- a/jstests/sharding/read_pref.js +++ b/jstests/sharding/read_pref.js @@ -57,8 +57,19 @@ jsTest.log( 'connpool: ' + tojson(conn.getDB('admin').runCommand({ connPoolStats var coll = conn.getDB( 'test' ).user; -coll.insert({ x: 1 }); -assert.eq( null, coll.getDB().getLastError( NODES )); +assert.soon(function() { + coll.insert({ x: 1 }); + var err = coll.getDB().getLastError(NODES); + if (err == null) { + return true; + } + // Transient transport errors may be expected b/c of the replSetReconfig + if (err.indexOf("transport error") == -1) { + throw err; + } + return false; +}); + // Read pref should work without slaveOk var explain = coll.find().readPref( "secondary" ).explain(); |