Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix rename.js to work for both SM and v8

  • Loading branch information...
commit a6684a66aa6cf39f282341c4b735833a90d5d8e3 1 parent 13e7127
Antoine Girbal agirbal authored

Showing 1 changed file with 11 additions and 6 deletions. Show diff stats Hide diff stats

  1. +11 6 jstests/rename.js
17 jstests/rename.js
@@ -32,18 +32,23 @@ b.drop();
32 32 c.drop();
33 33
34 34 // TODO: too many numbers hard coded here
35   -
  35 +// this test depends precisely on record size and hence may not be very reliable
  36 +// note we use floats to make sure numbers are represented as doubles for both SM and v8, since test relies on record size
36 37 db.createCollection( "jstests_rename_a", {capped:true,size:10000} );
37   -for( i = 0; i < 10; ++i ) {
  38 +for( i = 0.1; i < 10; ++i ) {
38 39 a.save( { i: i } );
39 40 }
40 41 assert.commandWorked( admin.runCommand( {renameCollection:"test.jstests_rename_a", to:"test.jstests_rename_b"} ) );
41   -assert.eq( 1, b.count( {i:9} ) );
42   -for( i = 10; i < 250; ++i ) {
  42 +assert.eq( 1, b.count( {i:9.1} ) );
  43 +for( i = 10.1; i < 250; ++i ) {
43 44 b.save( { i: i } );
44 45 }
45   -assert.eq( 0, b.count( {i:9} ) );
46   -assert.eq( 1, b.count( {i:19} ) );
  46 +
  47 +//res = b.find().sort({i:1});
  48 +//while (res.hasNext()) printjson(res.next());
  49 +
  50 +assert.eq( 0, b.count( {i:9.1} ) );
  51 +assert.eq( 1, b.count( {i:19.1} ) );
47 52
48 53 assert( db.system.namespaces.findOne( {name:"test.jstests_rename_b" } ) );
49 54 assert( !db.system.namespaces.findOne( {name:"test.jstests_rename_a" } ) );

0 comments on commit a6684a6

Please sign in to comment.
Something went wrong with that request. Please try again.