diff options
author | Benety Goh <benety@mongodb.com> | 2014-02-22 11:50:10 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-02-25 13:48:14 -0500 |
commit | 0b4ee727db118d01f28cb046c23068d4961990fe (patch) | |
tree | 27bbe28b955986ffabdf705bd2c35e6598afe80c /jstests/replsets | |
parent | 03b5eae78c653d7eb11df4ce26b9b28833e95e62 (diff) | |
download | mongo-0b4ee727db118d01f28cb046c23068d4961990fe.tar.gz |
SERVER-12842 do not add filterSet to explain if solution is not available in single solution runner
Diffstat (limited to 'jstests/replsets')
-rw-r--r-- | jstests/replsets/replsetadd.js | 69 | ||||
-rw-r--r-- | jstests/replsets/replsetadd_profile.js | 32 |
2 files changed, 32 insertions, 69 deletions
diff --git a/jstests/replsets/replsetadd.js b/jstests/replsets/replsetadd.js deleted file mode 100644 index 711a173931b..00000000000 --- a/jstests/replsets/replsetadd.js +++ /dev/null @@ -1,69 +0,0 @@ - -doTest = function( signal ) { - // Test add node - - var replTest = new ReplSetTest( {name: 'testSet', nodes: 0, host:"localhost"} ); - - var first = replTest.add(); - - // Initiate replica set - assert.soon(function() { - var res = first.getDB("admin").runCommand({replSetInitiate: { - _id : 'testSet', - members : [{_id : 0, host : "localhost:"+replTest.ports[0]}] - } - }); - return res['ok'] == 1; - }); - - // Get status - assert.soon(function() { - var result = first.getDB("admin").runCommand({replSetGetStatus: true}); - return result['ok'] == 1; - }); - - db = replTest.getMaster().getDB( "test"); - db.foo.insert( { x : 1} ); - db.foo.ensureIndex( { x : 1 } ); - - // Start a second node - var second = replTest.add(); - - // Add the second node. - // This runs the equivalent of rs.add(newNode); - print("calling add again"); - try { - replTest.reInitiate(); - } - catch(e) { - print(e); - } - - print("try to change to localhost to "+getHostName()); - var master = replTest.getMaster(); - - var config = master.getDB("local").system.replset.findOne(); - config.version++; - config.members.forEach(function(m) { - m.host = m.host.replace("localhost", getHostName()); - print(m.host); - }); - printjson(config); - - print("trying reconfig that shouldn't work"); - var result = master.getDB("admin").runCommand({replSetReconfig: config}); - assert.eq(result.ok, 0, tojson(result)); - assert.eq(result.code, 13645, tojson(result)); - - replTest.awaitReplication(); - - hashes = replTest.getHashes( "test" ); - printjson( hashes ); - for ( i=0; i<hashes.slaves.length; i++ ) { - assert.eq( hashes.master.collections.foo , hashes.slaves[i].collections.foo ); - } - - replTest.stopSet( signal ); -} - -doTest( 15 ); diff --git a/jstests/replsets/replsetadd_profile.js b/jstests/replsets/replsetadd_profile.js new file mode 100644 index 00000000000..d0cc27bf7ec --- /dev/null +++ b/jstests/replsets/replsetadd_profile.js @@ -0,0 +1,32 @@ +// Tests adding node to replica set with profiling enabled. +// Verifies that the oplog replay hack is compatible with +// the profiling option. +// One of the ways to exercise the oplog replay hack is to +// add a new node to an existing active replica set. + +// Initialize a single node replica set where +// the only node is running at a profiling level of 2. +var collectionName = 'jstests_replsetadd_profile'; + +var replTest = new ReplSetTest({name: 'ReplSetAddProfileTestSet', + nodes: [{profile: 2}], + host: "localhost"}); +replTest.startSet(); +replTest.initiate(); +var master = replTest.getMaster(); +var masterCollection = master.getDB('test').getCollection(collectionName); +masterCollection.save({a: 1}); + +// Add a new node with no profiling level. +var newNode = replTest.add(); +replTest.reInitiate(); + +// Allow documents to propagate to new replica set member. +replTest.awaitReplication(); + +var newNodeCollection = newNode.getDB('test').getCollection(collectionName); +assert.eq(1, newNodeCollection.find({a: 1}).itcount(), + 'expect documents to be present in slave after replication'); + +var signal = 15; +replTest.stopSet( signal ); |