[SERVER-12476] assert() calls that can't fail because of constant-value arguments Created: 24/Jan/14  Updated: 04/Nov/15  Resolved: 30/Oct/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.2.0-rc2

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Kevin Pulo
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-21087 Some uses of assert.throws() always pass Closed
is related to SERVER-20774 Force assert() to accept only booleans Open
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding A (10/09/15), Sharding B (10/30/15), Sharding C (11/20/15)
Participants:

 Description   

There are some assert() calls in jstests/ that will never fail because the first argument is a constant value:

$ egrep -nirI "assert\s*\(\s*[1-9]\s*," * 
core/batch_api_ordered.js:117:    assert(1, result.getWriteErrorCount());
core/batch_api_unordered.js:43:    assert(1, result.getWriteErrorCount());
core/batch_api_unordered.js:81:    assert(1, result.getWriteErrorCount());
core/batch_api_unordered.js:115:    assert(3, result.getWriteErrorCount());
sharding/diffservers1.js:13:assert( 3 , test1.count() );
sharding/movePrimary1.js:11:    assert( 3 , c.count() );
sharding/sync7.js:19:	assert( 3, c.count() );


Version: 56e6f5ac4bbff54b95ce956823e4b80fc6769bc9



 Comments   
Comment by Kevin Pulo [ 30/Oct/15 ]

(Commit msg has ticket number typo)

Author:

{u'username': u'devkev', u'name': u'Kevin Pulo', u'email': u'kevin.pulo@mongodb.com'}

Message: SERVER-12746: Fix assert() calls with constant-value args

These calls were mostly mistakes that should have been assert.eq().

assert() will now trip if passed a non-string msg, or too many params.
Branch: master
https://github.com/mongodb/mongo/commit/0c8b0d57c7072788e5f7f20af36214f0f9060099

Generated at Thu Feb 08 03:28:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.