Skip to content

Commit

Permalink
test: remove read preference pre 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Nov 3, 2021
1 parent 4e2d168 commit 892dcf1
Show file tree
Hide file tree
Showing 4 changed files with 341 additions and 68 deletions.
3 changes: 2 additions & 1 deletion src/operations/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export abstract class AbstractOperation<TResult = any> {
readPreference: ReadPreference;
server!: Server;
bypassPinningCheck: boolean;
trySecondaryWrite = false;
trySecondaryWrite: boolean;

// BSON serialization options
bsonOptions?: BSONSerializeOptions;
Expand All @@ -73,6 +73,7 @@ export abstract class AbstractOperation<TResult = any> {

this.options = options;
this.bypassPinningCheck = !!options.bypassPinningCheck;
this.trySecondaryWrite = false;
}

abstract execute(server: Server, session: ClientSession, callback: Callback<TResult>): void;
Expand Down
2 changes: 2 additions & 0 deletions src/sdam/server_selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export function secondaryWritableServerSelector(
/* eslint no-console: 0 */
console.log('select', readPreference, wireVersion);
if (!readPreference || (wireVersion && wireVersion < MIN_SECONDARY_WRITE_WIRE_VERSION)) {
/* eslint no-console: 0 */
console.log('force select primary');
return readPreferenceServerSelector(ReadPreference.primary);
}
return readPreferenceServerSelector(readPreference);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/crud_spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ describe('CRUD spec v1', function () {
}
});

describe('CRUD unified', function () {
describe.only('CRUD unified', function () {
for (const crudSpecTest of loadSpecTests('crud/unified')) {
expect(crudSpecTest).to.exist;
const testDescription = String(crudSpecTest.description);
Expand Down
Loading

0 comments on commit 892dcf1

Please sign in to comment.