jstests/libs/override_methods/inject_tenant_prefix.js
/**
 * Marks the outgoing tenant migration or shard split operation as having caused the shell to
 * reroute commands by inserting a document for it into the testTenantMigration.rerouted collection.
 */
Marks the outgoing tenant migration or shard split operation as having caused the shell to
reroute commands by inserting a document for it into the testTenantMigration.rerouted collection.
Marks the outgoing tenant migration or shard split operation as having caused the shell to reroute commands by inserting a document for it into the testTenantMigration . rerouted collection .
function recordRerouteDueToTenantMigration(conn, migrationStateDoc) {
    assertRoutingConnection(conn);
    while (true) {
        try {
            const res = originalRunCommand.apply(conn, [
                "testTenantMigration",
                {
                    insert: "rerouted",
                    documents: [{_id: migrationStateDoc._id}],
                    writeConcern: {w: "majority"}
                },
                0
            ]);
            if (res.ok) {
                break;
            } else if (isRetryableError(res)) {
                jsTest.log(
                    "Failed to write to testTenantMigration.rerouted due to a retryable error " +
                    tojson(res));
                continue;
            } else {
                assert.commandWorked(res);
            }
        } catch (e) {
            if (isRetryableError(e)) {
                jsTest.log(
                    "Failed to write to testTenantMigration.rerouted due to a retryable error exception " +
                    tojson(e));
                continue;
            }
            throw e;
        }
    }
}
function recordRerouteDueToTenantMigration ( conn , migrationStateDoc ) { assertRoutingConnection ( conn ) ; while ( true ) { try { const res = originalRunCommand . apply ( conn , [ "testTenantMigration" , { insert : "rerouted" , documents : [ { _id : migrationStateDoc . _id } ] , writeConcern : { w : "majority" } } , 0 ] ) ; if ( res . ok ) { break ; } else if ( isRetryableError ( res ) ) { jsTest . log ( "Failed to write to testTenantMigration.rerouted due to a retryable error " + tojson ( res ) ) ; continue ; } else { assert . commandWorked ( res ) ; } } catch ( e ) { if ( isRetryableError ( e ) ) { jsTest . log ( "Failed to write to testTenantMigration.rerouted due to a retryable error exception " + tojson ( e ) ) ; continue ; } throw e ; } } }
Marks the outgoing tenant migration or shard split operation as having caused the shell to
 reroute commands by inserting a document for it into the testTenantMigration.rerouted collection.
Marks the outgoing tenant migration or shard split operation as having caused the shell to reroute commands by inserting a document for it into the testTenantMigration . rerouted collection .
// Throw non-retryable errors. // Since the shell can throw custom errors that don't propagate the error code, check // these exceptions for specific network error messages. // TODO SERVER-54026: Remove check for network error messages once the shell reliably // returns error codes.