Skip to content

Commit

Permalink
feat(NODE-6244): Bump max supported wire version and server version (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James authored Jun 27, 2024
1 parent 25c84a4 commit 45bc098
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/cmap/wire_protocol/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const MIN_SUPPORTED_SERVER_VERSION = '3.6';
export const MAX_SUPPORTED_SERVER_VERSION = '7.0';
export const MAX_SUPPORTED_SERVER_VERSION = '8.0';
export const MIN_SUPPORTED_WIRE_VERSION = 6;
export const MAX_SUPPORTED_WIRE_VERSION = 21;
export const MAX_SUPPORTED_WIRE_VERSION = 25;
export const MIN_SUPPORTED_QE_WIRE_VERSION = 21;
export const MIN_SUPPORTED_QE_SERVER_VERSION = '7.0';
export const OP_REPLY = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
'use strict';
import { expect } from 'chai';

const mock = require('../../tools/mongodb-mock/index');
const { expect } = require('chai');
const { MongoServerSelectionError, MongoClient } = require('../../mongodb');
const { isHello } = require('../../mongodb');
import {
isHello,
MAX_SUPPORTED_WIRE_VERSION,
MIN_SUPPORTED_WIRE_VERSION,
MongoClient,
MongoServerSelectionError
} from '../../mongodb';
import * as mock from '../../tools/mongodb-mock/index';

const minCompatErrMsg = `minimum wire version ${
Number.MAX_SAFE_INTEGER - 1
}, but this version of the Node.js Driver requires at most 21`;
const maxCompatErrMsg = `reports maximum wire version 1, but this version of the Node.js Driver requires at least 6`;
}, but this version of the Node.js Driver requires at most ${MAX_SUPPORTED_WIRE_VERSION}`;
const maxCompatErrMsg = `reports maximum wire version 1, but this version of the Node.js Driver requires at least ${MIN_SUPPORTED_WIRE_VERSION}`;

describe('Wire Protocol Version', () => {
/** @type {mock.MockServer} */
let server, client;
let server, client: MongoClient;

function setWireProtocolMessageHandler(min, max) {
server.setMessageHandler(req => {
Expand Down Expand Up @@ -41,7 +44,6 @@ describe('Wire Protocol Version', () => {
it('should raise a compatibility error', async function () {
setWireProtocolMessageHandler(Number.MAX_SAFE_INTEGER - 1, Number.MAX_SAFE_INTEGER);

/** @type {MongoClient} */
client = new MongoClient(
`mongodb://${server.uri()}/wireVersionTest?serverSelectionTimeoutMS=200`
);
Expand All @@ -59,7 +61,6 @@ describe('Wire Protocol Version', () => {
it('should raise a compatibility error', async function () {
setWireProtocolMessageHandler(1, 1);

/** @type {MongoClient} */
client = new MongoClient(
`mongodb://${server.uri()}/wireVersionTest?serverSelectionTimeoutMS=200`
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const { expect } = require('chai');
const {
MIN_SUPPORTED_SERVER_VERSION,
import { expect } from 'chai';

import {
MAX_SUPPORTED_SERVER_VERSION,
MIN_SUPPORTED_WIRE_VERSION,
MAX_SUPPORTED_WIRE_VERSION
} = require('../../../mongodb');
MAX_SUPPORTED_WIRE_VERSION,
MIN_SUPPORTED_SERVER_VERSION,
MIN_SUPPORTED_WIRE_VERSION
} from '../../../mongodb';

describe('Wire Protocol Constants', function () {
describe('MIN_SUPPORTED_SERVER_VERSION', function () {
Expand All @@ -14,8 +15,8 @@ describe('Wire Protocol Constants', function () {
});

describe('MAX_SUPPORTED_SERVER_VERSION', function () {
it('returns 7.0', function () {
expect(MAX_SUPPORTED_SERVER_VERSION).to.equal('7.0');
it('returns 8.0', function () {
expect(MAX_SUPPORTED_SERVER_VERSION).to.equal('8.0');
});
});

Expand All @@ -26,8 +27,8 @@ describe('Wire Protocol Constants', function () {
});

describe('MAX_SUPPORTED_WIRE_VERSION', function () {
it('returns 21', function () {
expect(MAX_SUPPORTED_WIRE_VERSION).to.equal(21);
it('returns 25', function () {
expect(MAX_SUPPORTED_WIRE_VERSION).to.equal(25);
});
});
});

0 comments on commit 45bc098

Please sign in to comment.