diff options
author | Bynn Lee <bynn.lee@mongodb.com> | 2021-02-26 16:52:14 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-26 20:27:27 +0000 |
commit | 43224bbbba4f145093eec87d8ba6554a5c541118 (patch) | |
tree | ea1fc78fd95aa42ecfb76446ff06f84469e0b1c3 /jstests/hooks | |
parent | 614dbf274a3939359d9e351ce74d1d281dc12de3 (diff) | |
download | mongo-43224bbbba4f145093eec87d8ba6554a5c541118.tar.gz |
SERVER-40820 Jstestfuzz suite to introduce spurious write conflicts
Diffstat (limited to 'jstests/hooks')
-rw-r--r-- | jstests/hooks/disable_write_conflicts.js | 9 | ||||
-rw-r--r-- | jstests/hooks/enable_write_conflicts.js | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/jstests/hooks/disable_write_conflicts.js b/jstests/hooks/disable_write_conflicts.js new file mode 100644 index 00000000000..42c00693b83 --- /dev/null +++ b/jstests/hooks/disable_write_conflicts.js @@ -0,0 +1,9 @@ +(function() { +'use strict'; + +assert.commandWorked( + db.adminCommand({configureFailPoint: 'WTWriteConflictException', mode: "off"})); + +assert.commandWorked( + db.adminCommand({configureFailPoint: 'WTWriteConflictExceptionForReads', mode: "off"})); +})(); diff --git a/jstests/hooks/enable_write_conflicts.js b/jstests/hooks/enable_write_conflicts.js new file mode 100644 index 00000000000..aae999f4253 --- /dev/null +++ b/jstests/hooks/enable_write_conflicts.js @@ -0,0 +1,19 @@ +(function() { +'use strict'; + +const chance = TestData.WTWriteConflictExceptionChance; +assert.gte(chance, 0, "WTWriteConflictExceptionChance must be >= 0"); +assert.lte(chance, 1, "WTWriteConflictExceptionChance must be <= 1"); + +const readChance = TestData.WTWriteConflictExceptionForReadsChance; +assert.gte(readChance, 0, "WTWriteConflictExceptionForReadsChance must be >= 0"); +assert.lte(readChance, 1, "WTWriteConflictExceptionForReadsChance must be <= 1"); + +assert.commandWorked(db.adminCommand( + {configureFailPoint: 'WTWriteConflictException', mode: {activationProbability: chance}})); + +assert.commandWorked(db.adminCommand({ + configureFailPoint: 'WTWriteConflictExceptionForReads', + mode: {activationProbability: readChance} +})); +})(); |