summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-11-02 14:01:10 -0400
committerEliot Horowitz <eliot@10gen.com>2011-11-08 13:31:56 -0500
commitd2feeb87c806e9649c79cb229261592225282bba (patch)
tree4d01a501a6be55ff062b4a6a915be4b5f7379de8
parent3e5d0e345bea106e5fb5fd5c7990dc5af7c58ba5 (diff)
downloadmongo-d2feeb87c806e9649c79cb229261592225282bba.tar.gz
make test not hard code sharding knowledge
-rw-r--r--jstests/sharding/sort1.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/jstests/sharding/sort1.js b/jstests/sharding/sort1.js
index e2b287e6aa1..235e5c0b027 100644
--- a/jstests/sharding/sort1.js
+++ b/jstests/sharding/sort1.js
@@ -22,11 +22,18 @@ s.adminCommand( { split : "test.data" , middle : { 'sub.num' : 66 } } )
s.adminCommand( { movechunk : "test.data" , find : { 'sub.num' : 50 } , to : s.getOther( s.getServer( "test" ) ).name } );
-assert.eq( 3 , s.config.chunks.find().itcount() , "A1" );
+assert.lte( 3 , s.config.chunks.find().itcount() , "A1" );
temp = s.config.chunks.find().sort( { min : 1 } ).toArray();
-assert.eq( temp[0].shard , temp[2].shard , "A2" );
-assert.neq( temp[0].shard , temp[1].shard , "A3" );
+temp.forEach( printjsononeline )
+
+z = 0;
+for ( ; z<temp.length; z++ )
+ if ( temp[z].min["sub.num"] <= 50 && temp[z].max["sub.num"] > 50 )
+ break;
+
+assert.eq( temp[z-1].shard , temp[z+1].shard , "A2" );
+assert.neq( temp[z-1].shard , temp[z].shard , "A3" );
temp = db.data.find().sort( { 'sub.num' : 1 } ).toArray();
assert.eq( N , temp.length , "B1" );