[SERVER-20519] JS tests use Random.rand() without ever setting a seed Created: 21/Sep/15  Updated: 05/Feb/16  Resolved: 31/Dec/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: 3.1.8
Fix Version/s: 3.3.0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Jonathan Abrahams
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-20376 backup_restore.js FSM tests are not r... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: TIG E (01/08/16)
Participants:

 Description   

The mongo shell will always produce the same set of random numbers if not seeded.

$ ~/mongodb/3.1.7/mongo --nodb
MongoDB shell version: 3.1.7
> Random.randInt(1000000)
242578
> ^C
bye
$ ~/mongodb/3.1.7/mongo --nodb
MongoDB shell version: 3.1.7
> Random.randInt(1000000)
242578

Tests that use Random.rand() or Random.randInt():

  • jstests/core/geo_array2.js
  • jstests/core/geo_update_btree.js (also affects the parallel shell)
  • jstests/core/geo_update_btree2.js
  • jstests/core/remove9.js
  • jstests/core/removec.js
  • jstests/dur/manyRestart.js
  • jstests/multiVersion/mixed_storage_version_replication.js
  • jstests/noPassthrough/initial_sync_cloner_dups.js
  • jstests/noPassthroughWithMongod/indexbg_drop.js
  • jstests/noPassthroughWithMongod/mr_writeconflict.js
  • jstests/noPassthroughWithMongod/remove9.js
  • jstests/noPassthroughWithMongod/sharding_balance4.js
  • jstests/sharding/geo_shardedgeonear.js
  • jstests/slow2/remove_during_mr.js (also affects the ScopedThreads)

Tests that use Array.shuffle():

  • aggregation/bugs/server6125.js
  • sharding/key_many.js


 Comments   
Comment by Githook User [ 31/Dec/15 ]

Author:

{u'username': u'hptabster', u'name': u'Jonathan Abrahams', u'email': u'jonathan@mongodb.com'}

Message: SERVER-20519 Set random seed, assert if seed not set and random function is invoked.
Branch: master
https://github.com/mongodb/mongo/commit/42161c26220fcd650fd9cd87ea7d94ca8b2b7913

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