From f063c183ac04468563fde5405ba9b283306b0c10 Mon Sep 17 00:00:00 2001 From: Henrik Edin Date: Tue, 18 Feb 2020 10:38:43 -0500 Subject: SERVER-46026 Fix initial_sync_drop_against_last_stable.js with JSON logs --- .../initial_sync_drop_against_last_stable.js | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'jstests/multiVersion') diff --git a/jstests/multiVersion/initial_sync_drop_against_last_stable.js b/jstests/multiVersion/initial_sync_drop_against_last_stable.js index e36a2a8606e..bcccaa96fef 100644 --- a/jstests/multiVersion/initial_sync_drop_against_last_stable.js +++ b/jstests/multiVersion/initial_sync_drop_against_last_stable.js @@ -78,7 +78,7 @@ function setupTest({failPoint, extraFailPointData, secondaryStartupParams}) { replTest.waitForState(secondary, ReplSetTest.State.STARTUP_2); } -function finishTest({failPoint, expectedLog, waitForDrop, createNew}) { +function finishTest({failPoint, expectedLog, expectedLogId, waitForDrop, createNew}) { // Get the uuid for use in checking the log line. let uuid = getUUIDFromListCollections(primaryDB, collName); @@ -99,13 +99,24 @@ function finishTest({failPoint, expectedLog, waitForDrop, createNew}) { jsTestLog("Allowing secondary to continue."); assert.commandWorked(secondary.adminCommand({configureFailPoint: failPoint, mode: 'off'})); - if (expectedLog) { - expectedLog = eval(expectedLog); - if (isJsonLog(primaryColl.getMongo())) { - expectedLog = expectedLog.replace(/"/g, "\\\""); + if (isJsonLog(primaryColl.getMongo())) { + if (expectedLogId) { + let attrValues = { + "ns": nss, + "uuid": function(attr) { + return BinData(parseInt(attr.uuid.$binary.subType), attr.uuid.$binary.base64) + .toString() === uuid.toString(); + } + }; + + checkLog.containsJson(secondary, expectedLogId, attrValues); + } + } else { + if (expectedLog) { + expectedLog = eval(expectedLog); + jsTestLog(expectedLog); + checkLog.contains(secondary, expectedLog); } - jsTestLog(expectedLog); - checkLog.contains(secondary, expectedLog); } jsTestLog("Waiting for initial sync to complete."); @@ -148,6 +159,7 @@ runDropTest({ failPoint: "initialSyncHangCollectionClonerAfterHandlingBatchResponse", secondaryStartupParams: {collectionClonerBatchSize: 1}, waitForDrop: true, + expectedLogId: 21132, expectedLog: "`CollectionCloner ns: '${nss}' uuid: ${uuid} stopped because collection was dropped on source.`" }); @@ -158,6 +170,7 @@ runDropTest({ failPoint: "initialSyncHangCollectionClonerAfterHandlingBatchResponse", secondaryStartupParams: {collectionClonerBatchSize: 1}, waitForDrop: true, + expectedLogId: 21132, expectedLog: "`CollectionCloner ns: '${nss}' uuid: ${uuid} stopped because collection was dropped on source.`", createNew: true -- cgit v1.2.1