Skip to content

Commit

Permalink
SERVER-26047 Assert that fail point is configured successfully in wri…
Browse files Browse the repository at this point in the history
…te_concern_util.js
  • Loading branch information
renctan committed Sep 12, 2016
1 parent fd3c6c1 commit 8cea6e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jstests/libs/write_concern_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function shardCollectionWithChunks(st, coll) {

// Stops replication at a server.
function stopServerReplication(conn) {
conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'});
assert.commandWorked(
conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'}));
}

// Stops replication at all replicaset secondaries.
Expand All @@ -35,7 +36,8 @@ function stopReplicationOnSecondariesOfAllShards(st) {

// Restarts replication at a server.
function restartServerReplication(conn) {
conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'});
assert.commandWorked(
conn.getDB('admin').runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}));
}

// Restarts replication at all nodes in a replicaset.
Expand Down
5 changes: 5 additions & 0 deletions src/mongo/db/commands/fail_point_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* it in the license file.
*/

#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand

#include <vector>

#include "mongo/base/init.h"
Expand All @@ -34,6 +36,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"

namespace mongo {

Expand Down Expand Up @@ -160,6 +163,8 @@ class FaultInjectCmd : public Command {
}

failPoint->setMode(mode, val, dataObj);
warning() << "failpoint: " << failPointName << " set to: " << failPoint->toBSON();

return true;
}
};
Expand Down

0 comments on commit 8cea6e9

Please sign in to comment.