0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

SERVER-46026 index_stepdown_after_init.js tests against stuctured logs

This commit is contained in:
Gabriel Russell 2020-02-19 14:08:02 -05:00 committed by Evergreen Agent
parent d9498822ad
commit 3d92f8e574
2 changed files with 16 additions and 4 deletions

View File

@ -21,7 +21,6 @@ selector:
- jstests/noPassthrough/loglong.js
- jstests/noPassthrough/hybrid_index_with_updates.js
- jstests/noPassthrough/hybrid_unique_index_with_updates.js
- jstests/noPassthrough/index_stepdown_after_init.js
# noPassthrough tests start their own mongod's.
executor:

View File

@ -7,6 +7,7 @@
"use strict";
load('jstests/noPassthrough/libs/index_build.js');
load("jstests/libs/logv2_helpers.js");
const rst = new ReplSetTest({
nodes: [
@ -34,8 +35,15 @@ assert.commandWorked(primary.adminCommand(
const createIdx = IndexBuildTest.startIndexBuild(primary, coll.getFullName(), {a: 1});
checkLog.contains(
primary, 'index build: starting on ' + coll.getFullName() + ' properties: { v: 2, key: { a:');
if (isJsonLogNoConn()) {
checkLog.contains(
primary,
/\"index build: starting on {ns} properties: {descriptor} using method: {method}\".*\"descriptor\":\"{ v: 2, key: { a:/);
} else {
checkLog.contains(
primary,
'index build: starting on ' + coll.getFullName() + ' properties: { v: 2, key: { a:');
}
try {
// Step down the primary.
@ -54,7 +62,12 @@ assert.neq(0, exitCode, 'expected shell to exit abnormally due to index build be
if (!IndexBuildTest.supportsTwoPhaseIndexBuild(primary)) {
// Wait for the IndexBuildCoordinator thread, not the command thread, to report the index build
// as failed.
checkLog.contains(primary, '[IndexBuildsCoordinatorMongod-0] Index build failed: ');
if (isJsonLogNoConn()) {
checkLog.contains(
primary, "\"ctx\":\"IndexBuildsCoordinatorMongod-0\",\"msg\":\"Index build failed");
} else {
checkLog.contains(primary, '[IndexBuildsCoordinatorMongod-0] Index build failed: ');
}
// Check that no new index has been created. This verifies that the index build was aborted
// rather than successfully completed.