diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-11-02 14:01:10 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-11-02 14:01:47 -0400 |
commit | 618f349e2322e7f4b04e7f7aeae4e84aa89019e9 (patch) | |
tree | cb522cceec22d95e37e9470fa6d47fd6797f939b /jstests/sharding/sort1.js | |
parent | 98d5685751fd8e95922fe0da6271f5e7d8ac88ba (diff) | |
download | mongo-618f349e2322e7f4b04e7f7aeae4e84aa89019e9.tar.gz |
make test not hard code sharding knowledge
Diffstat (limited to 'jstests/sharding/sort1.js')
-rw-r--r-- | jstests/sharding/sort1.js | 13 |
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" ); |