summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-02-14 14:59:22 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-18 18:03:38 +0000
commit0e8ab1c19d875a075883fde1039dcab988955671 (patch)
tree699fd5c8d2458959a4e4a6a4174fcaed9ef8ad2b
parente01b8611919d8da6510818bf8a27e78e0c038418 (diff)
downloadmongo-0e8ab1c19d875a075883fde1039dcab988955671.tar.gz
SERVER-46026 jsCore_txns tests against structured logs
-rw-r--r--jstests/core/txns/kill_op_on_txn_expiry.js11
-rw-r--r--jstests/core/txns/speculative_snapshot_includes_all_writes.js13
-rw-r--r--jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js8
3 files changed, 28 insertions, 4 deletions
diff --git a/jstests/core/txns/kill_op_on_txn_expiry.js b/jstests/core/txns/kill_op_on_txn_expiry.js
index 154dc9ec5c5..98d30ca78ba 100644
--- a/jstests/core/txns/kill_op_on_txn_expiry.js
+++ b/jstests/core/txns/kill_op_on_txn_expiry.js
@@ -5,6 +5,7 @@
load("jstests/libs/fail_point_util.js");
load('jstests/libs/parallelTester.js');
+load("jstests/libs/logv2_helpers.js");
const dbName = "test";
const collName = "kill_op_on_txn_expiry";
@@ -71,7 +72,15 @@ try {
failPoint.wait();
jsTestLog("Wait for the transaction to expire");
- checkLog.contains(db.getMongo(), "Aborting transaction with txnNumber " + txnNumber);
+ if (isJsonLogNoConn()) {
+ checkLog.contains(
+ db.getMongo(),
+ new RegExp(
+ "Aborting transaction with txnNumber.*\"txnParticipant_getActiveTxnNumber\":" +
+ txnNumber));
+ } else {
+ checkLog.contains(db.getMongo(), "Aborting transaction with txnNumber " + txnNumber);
+ }
jsTestLog("Disabling fail point to enable insert to proceed and detect that the session " +
"has been killed");
diff --git a/jstests/core/txns/speculative_snapshot_includes_all_writes.js b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
index edb97ddeb79..052d2abc554 100644
--- a/jstests/core/txns/speculative_snapshot_includes_all_writes.js
+++ b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
@@ -6,6 +6,8 @@
(function() {
"use strict";
+load("jstests/libs/logv2_helpers.js");
+
const dbName = "test";
const collName = "speculative_snapshot_includes_all_writes_1";
const collName2 = "speculative_snapshot_includes_all_writes_2";
@@ -59,8 +61,15 @@ const joinHungWrite = startParallelShell(() => {
{_id: "b"}, {writeConcern: {w: "majority"}}));
});
-checkLog.contains(db.getMongo(),
- "hangAfterCollectionInserts fail point enabled for " + testColl2.getFullName());
+if (isJsonLogNoConn()) {
+ checkLog.contains(db.getMongo(),
+ new RegExp("hangAfterCollectionInserts fail point enabled for.*\"ns\":\"" +
+ testColl2.getFullName() + "\""));
+} else {
+ checkLog.contains(
+ db.getMongo(),
+ "hangAfterCollectionInserts fail point enabled for " + testColl2.getFullName());
+}
jsTest.log("Create a write following the uncommitted write.");
// Note this write must use local write concern; it cannot be majority committed until
diff --git a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
index fce4e205d88..317bbe7feba 100644
--- a/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
+++ b/jstests/core/txns/timestamped_reads_wait_for_prepare_oplog_visibility.js
@@ -38,6 +38,7 @@ TestData.otherDocFilter = {
* certain reads and that prepare conflicts block other types of reads.
*/
const readThreadFunc = function(readFunc, _collName, timesEntered) {
+ load("jstests/libs/logv2_helpers.js");
load("jstests/libs/fail_point_util.js");
// Do not start reads until we are blocked in 'prepareTransaction'.
@@ -54,7 +55,12 @@ const readThreadFunc = function(readFunc, _collName, timesEntered) {
// Let the transaction finish preparing and wait for 'prepareTransaction' to complete.
assert.commandWorked(
db.adminCommand({configureFailPoint: 'hangAfterReservingPrepareTimestamp', mode: 'off'}));
- checkLog.contains(db.getMongo(), "command: prepareTransaction");
+
+ if (isJsonLogNoConn()) {
+ checkLog.contains(db.getMongo(), "\"command\":{\"prepareTransaction\":");
+ } else {
+ checkLog.contains(db.getMongo(), "command: prepareTransaction");
+ }
readFuncObj.prepareConflict();
};