diff options
author | Spencer T Brody <spencer@10gen.com> | 2011-08-29 19:48:15 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2011-08-29 19:50:47 -0400 |
commit | ae3201b73d06f139912aca4573994f1ed0c68d7b (patch) | |
tree | f012cbe4dc00f730da9bfa8beabb0b88ccb50cb9 | |
parent | a406f1b8f4adba88b876417df5a8b081695c05a9 (diff) | |
download | mongo-ae3201b73d06f139912aca4573994f1ed0c68d7b.tar.gz |
Fix sharding index creation tests. Now can catch SERVER-3718.
-rw-r--r-- | jstests/sharding/index1.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/jstests/sharding/index1.js b/jstests/sharding/index1.js index 6c9b3e68352..7a554c9da0b 100644 --- a/jstests/sharding/index1.js +++ b/jstests/sharding/index1.js @@ -22,12 +22,14 @@ for ( var i = 0; i < 10; i++ ) { coll.ensureIndex( { num : 1 }, { unique : true } ) coll.ensureIndex( { x : 1 } ) + passed = false try { s.adminCommand( { shardcollection : "" + coll, key : { x : 1 } } ) - assert( false, "Should not shard collection when another unique index exists!" ) + passed = true } catch (e) { print( e ) } + assert( !passed, "Should not shard collection when another unique index exists!") } if ( i == 1 ) { @@ -46,18 +48,22 @@ for ( var i = 0; i < 10; i++ ) { } if ( i == 2 ) { - - // Unique index exists as prefix, also index exists + if (false) { // SERVER-3718 + // Non-unique index exists as prefix, also index exists. No unique index. coll.ensureIndex( { x : 1 } ) coll.ensureIndex( { x : 1, num : 1 } ) + passed = false; try{ s.adminCommand({ shardcollection : "" + coll, key : { x : 1 } }) - assert( false, "Should not shard collection with non-unique prefix index.") + passed = true; + } catch( e ){ print(e) + assert( !passed, "Should not shard collection with no unique index.") } + } } if ( i == 3 ) { |