Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Mar 4, 2022
1 parent c9acb6b commit d813012
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
10 changes: 2 additions & 8 deletions src/operations/execute_operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function executeOperation<

function executeWithServerSelection<TResult>(
topology: Topology,
session: ClientSession | undefined,
session: ClientSession,
operation: AbstractOperation,
callback: Callback<TResult>
) {
Expand All @@ -140,12 +140,7 @@ function executeWithServerSelection<TResult>(
);
}

if (
session &&
session.isPinned &&
session.transaction.isCommitted &&
!operation.bypassPinningCheck
) {
if (session.isPinned && session.transaction.isCommitted && !operation.bypassPinningCheck) {
session.unpin();
}

Expand Down Expand Up @@ -189,7 +184,6 @@ function executeWithServerSelection<TResult>(

if (
originalError instanceof MongoNetworkError &&
session &&
session.isPinned &&
!session.inTransaction() &&
operation.hasAspect(Aspect.CURSOR_CREATING)
Expand Down
20 changes: 10 additions & 10 deletions test/tools/spec-runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,19 @@ function validateExpectations(commandEvents, spec, savedSessionData) {
const rawExpectedEvents = spec.expectations.map(x => x.command_started_event);
const expectedEvents = normalizeCommandShapes(rawExpectedEvents);

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

expect(actualEvents.map(({ databaseName }) => databaseName)).to.deep.equal(
expectedEvents.map(({ databaseName }) => databaseName)
);
if (typeof expectedEvent.commandName === 'string') {
expect(actualEvent).to.have.property('commandName', expectedEvent.commandName);
}

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

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

0 comments on commit d813012

Please sign in to comment.