Skip to content

Commit a984ee6

Browse files
committed
wip
1 parent a56ec4c commit a984ee6

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

src/operations/execute_operation.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function executeOperation<
125125

126126
function executeWithServerSelection<TResult>(
127127
topology: Topology,
128-
session: ClientSession | undefined,
128+
session: ClientSession,
129129
operation: AbstractOperation,
130130
callback: Callback<TResult>
131131
) {
@@ -140,12 +140,7 @@ function executeWithServerSelection<TResult>(
140140
);
141141
}
142142

143-
if (
144-
session &&
145-
session.isPinned &&
146-
session.transaction.isCommitted &&
147-
!operation.bypassPinningCheck
148-
) {
143+
if (session.isPinned && session.transaction.isCommitted && !operation.bypassPinningCheck) {
149144
session.unpin();
150145
}
151146

@@ -189,7 +184,6 @@ function executeWithServerSelection<TResult>(
189184

190185
if (
191186
originalError instanceof MongoNetworkError &&
192-
session &&
193187
session.isPinned &&
194188
!session.inTransaction() &&
195189
operation.hasAspect(Aspect.CURSOR_CREATING)

test/tools/spec-runner/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,19 @@ function validateExpectations(commandEvents, spec, savedSessionData) {
459459
const rawExpectedEvents = spec.expectations.map(x => x.command_started_event);
460460
const expectedEvents = normalizeCommandShapes(rawExpectedEvents);
461461

462-
expect(actualEvents.map(({ commandName }) => commandName)).to.deep.equal(
463-
expectedEvents.map(({ commandName }) => commandName)
464-
);
462+
for (const [idx, expectedEvent] of expectedEvents.entries()) {
463+
const actualEvent = actualEvents[idx];
465464

466-
expect(actualEvents.map(({ databaseName }) => databaseName)).to.deep.equal(
467-
expectedEvents.map(({ databaseName }) => databaseName)
468-
);
465+
if (typeof expectedEvent.commandName === 'string') {
466+
expect(actualEvent).to.have.property('commandName', expectedEvent.commandName);
467+
}
469468

470-
for (const [idx, expected] of expectedEvents.entries()) {
471-
const actual = actualEvents[idx];
469+
if (typeof expectedEvent.databaseName === 'string') {
470+
expect(actualEvent).to.have.property('databaseName', expectedEvent.databaseName);
471+
}
472472

473-
const actualCommand = actual.command;
474-
const expectedCommand = expected.command;
473+
const actualCommand = actualEvent.command;
474+
const expectedCommand = expectedEvent.command;
475475
if (expectedCommand.sort) {
476476
// TODO(NODE-3235): This is a workaround that works because all sorts in the specs
477477
// are objects with one key; ideally we'd want to adjust the spec definitions

0 commit comments

Comments
 (0)