[SERVER-22582] Wrap assert.soon bodies in try catch in replsettest.js Created: 11/Feb/16  Updated: 07/Sep/17  Resolved: 18/Feb/16

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.2.14, 3.3.2

Type: Bug Priority: Critical - P2
Reporter: Scott Hernandez (Inactive) Assignee: Judah Schvimer
Resolution: Done Votes: 0
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.2
Participants:
Linked BF Score: 0

 Description   

Currently any exception in an assert.soon will cause a failure when we probably just want to retry, like in replsettest.js::awaitLastOpCommitted line:601.



 Comments   
Comment by Githook User [ 22/May/17 ]

Author:

{u'username': u'judahschvimer', u'name': u'Judah Schvimer', u'email': u'judah@mongodb.com'}

Message: SERVER-22582 Wrap assert.soon bodies in try catch in replsettest.js
Branch: v3.2
https://github.com/mongodb/mongo/commit/aa796e3a1e2bce7ec6af0b6d15ecff0ae3c102a3

Comment by Githook User [ 18/Feb/16 ]

Author:

{u'username': u'judahschvimer', u'name': u'Judah Schvimer', u'email': u'judah@mongodb.com'}

Message: SERVER-22582 wrap assert.soon functions in try...catch in ReplSetTest
Branch: master
https://github.com/mongodb/mongo/commit/9b3ce6e9fbcefff128189a1ad7259d848203b8ed

Comment by Eric Milkie [ 11/Feb/16 ]

For those function calls in replsettest.js that could throw exceptions, I agree they should be wrapped in try/catch's.

Comment by Scott Hernandez (Inactive) [ 11/Feb/16 ]

I'm not suggesting we change assert.soon but only the uses in replSetTest.js.

Also, we (unfortunately) already use assert.commandWorked when we really mean throwOnBadCommandResult:

    function _getLastOpTime(conn) {
        var replSetStatus =
            assert.commandWorked(conn.getDB("admin").runCommand({ replSetGetStatus: 1 }));
        var connStatus = replSetStatus.members.filter(m => m.self)[0];
        return connStatus.optime;
    }

Comment by Eric Milkie [ 11/Feb/16 ]

This would mean that any assert() call failure in an assert.soon would probably unintentionally break, since the programmer would expect the test to fail, not for the enclosing assert.soon to retry.

Generated at Thu Feb 08 04:00:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.