[SERVER-19325] Remove duplicate properties from objects in JS tests Created: 08/Jul/15  Updated: 05/Feb/16  Resolved: 10/Jul/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: 3.1.5
Fix Version/s: 3.1.6

Type: Improvement Priority: Trivial - P5
Reporter: J Delaney Assignee: J Delaney
Resolution: Done Votes: 0
Labels: dnsf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-20098 Fix duplicate property definition in ... Closed
related to SERVER-20099 Modify stageDebug command to strip fi... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

In some of the jstests there are cases of duplicated properties in an object. The first property declaration is redundant since the second one will override it. This causes problems for parsing the file for fuzzing.

  • jstests/core/cursor7.js:27
  • jstests/core/mr1.js:169
  • jstests/core/update6.js:20
  • jstests/sharding/key_string.js:29


 Comments   
Comment by Max Hirschhorn [ 10/Jul/15 ]

The tests jstests/core/stages_ixscan.js and jstests/core/stages_mergesort.js also have duplicate keys in the object literals they construct.

// 20 <= foo <= 30
// baz == 25 (in index so we can match against it.)
ixscan1 = {ixscan: {args:{keyPattern:{foo:1, baz: 1},
                          startKey: {"": 20, "":MinKey},
                          endKey: {"" : 30, "":MaxKey}, endKeyInclusive: true,
                          direction: 1},
                    filter: {baz: 25}}};
res = db.runCommand({stageDebug: {collection: collname, plan: ixscan1}});
assert.eq(res.ok, 1);
assert.eq(res.results.length, 1);

However, fixing these tests (and preserving their intent) requires changing the stageDebug command to accept startKey and endKey as arrays. The mongo shell has no way to guarantee an order for object keys, so using stripFieldNames() is not an effective solution. Enabling the mongo shell to query using ranges of a compound index with the stageDebug command will be done separately.

Comment by Githook User [ 10/Jul/15 ]

Author:

{u'username': u'j-delaney', u'name': u'J Delaney', u'email': u'j.delaney@mongodb.com'}

Message: SERVER-19325 Remove duplicate properties from objects in JS tests

Closes #998.

Signed-off-by: Max Hirschhorn <max.hirschhorn@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/3fb61fcb76c46c4714e62c119ef6e3222375715e

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