diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2018-05-17 13:25:33 -0400 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2018-07-23 14:10:52 -0400 |
commit | ca2564df6fa989819593bcf086403118e25e0292 (patch) | |
tree | 2798cf0c9274f1f980bc0048a1fb328ed2183076 | |
parent | 56326b0733062c56f6d37d6ccaa57faa7999962d (diff) | |
download | mongo-ca2564df6fa989819593bcf086403118e25e0292.tar.gz |
SERVER-26150 add retryOnNetworkError to assertAuthenticate
-rw-r--r-- | src/mongo/shell/utils_auth.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/shell/utils_auth.js b/src/mongo/shell/utils_auth.js index b0437f50bf3..054e8135a28 100644 --- a/src/mongo/shell/utils_auth.js +++ b/src/mongo/shell/utils_auth.js @@ -34,9 +34,12 @@ var authutil; conn = conns[i]; // Bypass the implicit auth call in getDB(); var db = new DB(conn, dbName); - assert(db.auth(authParams), - "Failed to authenticate " + conn + " to " + dbName + " using parameters " + - tojson(authParams)); + try { + retryOnNetworkError(db._authOrThrow.bind(db, authParams)); + } catch (ex3) { + doassert("assert failed : " + "Failed to authenticate " + conn + " to " + + dbName + " using parameters " + tojson(authParams) + " : " + ex3); + } } } catch (ex) { try { @@ -60,9 +63,13 @@ var authutil; conn = conns[i]; // Bypass the implicit auth call in getDB(); var db = new DB(conn, dbName); - assert(!db.auth(authParams), - "Unexpectedly authenticated " + conn + " to " + dbName + " using parameters " + - tojson(authParams)); + const ex = assert.throws(retryOnNetworkError, + [db._authOrThrow.bind(db, authParams)], + "Unexpectedly authenticated " + conn + " to " + dbName + + " using parameters " + tojson(authParams)); + if (isNetworkError(ex)) { + throw ex; + } } }; |