diff options
author | Robert Guo <robert.guo@10gen.com> | 2017-05-25 15:33:35 -0400 |
---|---|---|
committer | Robert Guo <robert.guo@10gen.com> | 2017-05-30 14:51:48 -0400 |
commit | 7b112f71fe551e92ae0a365f62fff402d4158035 (patch) | |
tree | 0d20c64242f8ed35145eb3c9458487512174d62c /jstests/replsets | |
parent | 3dc6ba1ad91727189c70ad41afdc446c76c81306 (diff) | |
download | mongo-7b112f71fe551e92ae0a365f62fff402d4158035.tar.gz |
SERVER-27549 Better check for when a server has shut down
Diffstat (limited to 'jstests/replsets')
-rw-r--r-- | jstests/replsets/initial_sync_invalid_index_spec.js | 14 | ||||
-rw-r--r-- | jstests/replsets/initial_sync_unsupported_auth_schema.js | 30 | ||||
-rw-r--r-- | jstests/replsets/invalid_index_spec.js | 13 |
3 files changed, 49 insertions, 8 deletions
diff --git a/jstests/replsets/initial_sync_invalid_index_spec.js b/jstests/replsets/initial_sync_invalid_index_spec.js index fc6e8dd7f77..d1126477894 100644 --- a/jstests/replsets/initial_sync_invalid_index_spec.js +++ b/jstests/replsets/initial_sync_invalid_index_spec.js @@ -22,7 +22,8 @@ {createIndexes: "test", indexes: [{v: 2, name: "x_1", key: {x: 1}, invalidOption: 1}]})); // Add another node to the replica set to allow an initial sync to occur. - var init_sync_node = replTest.add(); + var initSyncNode = replTest.add(); + var initSyncNodeAdminDB = initSyncNode.getDB("admin"); clearRawMongoProgramOutput(); reInitiateWithoutThrowingOnAbortedMember(replTest); @@ -36,7 +37,16 @@ }; assert.soon(assertFn, "Initial sync should have aborted on invalid index specification"); - replTest.stop(init_sync_node, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); + assert.soon(function() { + try { + initSyncNodeAdminDB.runCommand({ping: 1}); + } catch (e) { + return true; + } + return false; + }, "Node did not terminate due to invalid index spec during initial sync", 60 * 1000); + + replTest.stop(initSyncNode, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); replTest.stopSet(); })(); diff --git a/jstests/replsets/initial_sync_unsupported_auth_schema.js b/jstests/replsets/initial_sync_unsupported_auth_schema.js index 8e63c0039c1..5bc5d093bf4 100644 --- a/jstests/replsets/initial_sync_unsupported_auth_schema.js +++ b/jstests/replsets/initial_sync_unsupported_auth_schema.js @@ -19,7 +19,8 @@ function testInitialSyncAbortsWithUnsupportedAuthSchema(schema) { assert.writeOK(res); // Add another node to the replica set to allow an initial sync to occur - var init_sync_node = rst.add(); + var initSyncNode = rst.add(); + var initSyncNodeAdminDB = initSyncNode.getDB("admin"); clearRawMongoProgramOutput(); reInitiateWithoutThrowingOnAbortedMember(rst); @@ -45,7 +46,16 @@ function testInitialSyncAbortsWithUnsupportedAuthSchema(schema) { ' authSchema version: ' + tojson(schema), 60000); - rst.stop(init_sync_node, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); + assert.soon(function() { + try { + initSyncNodeAdminDB.runCommand({ping: 1}); + } catch (e) { + return true; + } + return false; + }, "Node did not terminate due to unsupported auth schema during initial sync", 60 * 1000); + + rst.stop(initSyncNode, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); rst.stopSet(); } @@ -65,7 +75,8 @@ function testInitialSyncAbortsWithExistingUserAndNoAuthSchema() { assert.writeOK(res); // Add another node to the replica set to allow an initial sync to occur - var init_sync_node = rst.add(); + var initSyncNode = rst.add(); + var initSyncNodeAdminDB = initSyncNode.getDB("admin"); clearRawMongoProgramOutput(); reInitiateWithoutThrowingOnAbortedMember(rst); @@ -85,9 +96,18 @@ function testInitialSyncAbortsWithExistingUserAndNoAuthSchema() { assert.soon(assertFn, 'Initial sync should have aborted due to an existing user document and' + ' a missing auth schema', - 60000); + 60 * 1000); + + assert.soon(function() { + try { + initSyncNodeAdminDB.runCommand({ping: 1}); + } catch (e) { + return true; + } + return false; + }, "Node did not terminate due to unsupported auth schema during initial sync", 60 * 1000); - rst.stop(init_sync_node, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); + rst.stop(initSyncNode, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); rst.stopSet(); } diff --git a/jstests/replsets/invalid_index_spec.js b/jstests/replsets/invalid_index_spec.js index 80f5da09055..6805c806a89 100644 --- a/jstests/replsets/invalid_index_spec.js +++ b/jstests/replsets/invalid_index_spec.js @@ -14,6 +14,8 @@ replTest.initiate(); let primaryDB = replTest.getPrimary().getDB(testName); + let secondary = replTest.getSecondary(); + let secondaryAdminDB = secondary.getDB("admin"); // Set a fail point that allows for index creation with invalid spec fields. primaryDB.adminCommand( @@ -38,6 +40,15 @@ }; assert.soon(assertFn, "Replication should have aborted on invalid index specification", 60000); - replTest.stop(replTest.getSecondary(), undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); + assert.soon(function() { + try { + secondaryAdminDB.runCommand({ping: 1}); + } catch (e) { + return true; + } + return false; + }, "Node did not terminate due to invalid index spec", 60 * 1000); + + replTest.stop(secondary, undefined, {allowedExitCode: MongoRunner.EXIT_ABRUPT}); replTest.stopSet(); })(); |