Skip to content

Commit fc719da

Browse files
ci(NODE-4651): add Node.js 18 (#3427)
1 parent 78bcfe4 commit fc719da

File tree

12 files changed

+166
-33
lines changed

12 files changed

+166
-33
lines changed

.evergreen/config.yml

Lines changed: 87 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,7 @@ buildvariants:
22502250
tasks:
22512251
- run-spec-benchmark-tests
22522252
- name: rhel80-large-erbium
2253-
display_name: rhel8 Node Erbium
2253+
display_name: rhel8 Node12
22542254
run_on: rhel80-large
22552255
expansions:
22562256
NODE_LTS_NAME: erbium
@@ -2298,7 +2298,7 @@ buildvariants:
22982298
- test-tls-support-4.4
22992299
- test-tls-support-4.2
23002300
- name: rhel80-large-fermium
2301-
display_name: rhel8 Node Fermium
2301+
display_name: rhel8 Node14
23022302
run_on: rhel80-large
23032303
expansions:
23042304
NODE_LTS_NAME: fermium
@@ -2346,7 +2346,7 @@ buildvariants:
23462346
- test-tls-support-4.4
23472347
- test-tls-support-4.2
23482348
- name: rhel80-large-gallium
2349-
display_name: rhel8 Node Gallium
2349+
display_name: rhel8 Node16
23502350
run_on: rhel80-large
23512351
expansions:
23522352
NODE_LTS_NAME: gallium
@@ -2391,8 +2391,50 @@ buildvariants:
23912391
- test-tls-support-5.0
23922392
- test-tls-support-4.4
23932393
- test-tls-support-4.2
2394+
- name: rhel80-large-hydrogen
2395+
display_name: rhel8 Node18
2396+
run_on: rhel80-large
2397+
expansions:
2398+
NODE_LTS_NAME: hydrogen
2399+
CLIENT_ENCRYPTION: true
2400+
tasks:
2401+
- test-latest-server
2402+
- test-latest-replica_set
2403+
- test-latest-sharded_cluster
2404+
- test-rapid-server
2405+
- test-rapid-replica_set
2406+
- test-rapid-sharded_cluster
2407+
- test-6.0-server
2408+
- test-6.0-replica_set
2409+
- test-6.0-sharded_cluster
2410+
- test-5.0-server
2411+
- test-5.0-replica_set
2412+
- test-5.0-sharded_cluster
2413+
- test-4.4-server
2414+
- test-4.4-replica_set
2415+
- test-4.4-sharded_cluster
2416+
- test-4.2-server
2417+
- test-4.2-replica_set
2418+
- test-4.2-sharded_cluster
2419+
- test-4.0-server
2420+
- test-4.0-replica_set
2421+
- test-4.0-sharded_cluster
2422+
- test-3.6-server
2423+
- test-3.6-replica_set
2424+
- test-3.6-sharded_cluster
2425+
- test-latest-server-v1-api
2426+
- test-atlas-connectivity
2427+
- test-5.0-load-balanced
2428+
- test-6.0-load-balanced
2429+
- test-latest-load-balanced
2430+
- test-auth-ldap
2431+
- test-tls-support-latest
2432+
- test-tls-support-6.0
2433+
- test-tls-support-5.0
2434+
- test-tls-support-4.4
2435+
- test-tls-support-4.2
23942436
- name: windows-64-vs2019-erbium
2395-
display_name: Windows (VS2019) Node Erbium
2437+
display_name: Windows (VS2019) Node12
23962438
run_on: windows-64-vs2019-large
23972439
expansions:
23982440
NODE_LTS_NAME: erbium
@@ -2434,7 +2476,7 @@ buildvariants:
24342476
- test-tls-support-4.4
24352477
- test-tls-support-4.2
24362478
- name: windows-64-vs2019-fermium
2437-
display_name: Windows (VS2019) Node Fermium
2479+
display_name: Windows (VS2019) Node14
24382480
run_on: windows-64-vs2019-large
24392481
expansions:
24402482
NODE_LTS_NAME: fermium
@@ -2476,7 +2518,7 @@ buildvariants:
24762518
- test-tls-support-4.4
24772519
- test-tls-support-4.2
24782520
- name: windows-64-vs2019-gallium
2479-
display_name: Windows (VS2019) Node Gallium
2521+
display_name: Windows (VS2019) Node16
24802522
run_on: windows-64-vs2019-large
24812523
expansions:
24822524
NODE_LTS_NAME: gallium
@@ -2515,11 +2557,48 @@ buildvariants:
25152557
- test-tls-support-5.0
25162558
- test-tls-support-4.4
25172559
- test-tls-support-4.2
2560+
- name: windows-64-vs2019-hydrogen
2561+
display_name: Windows (VS2019) Node18
2562+
run_on: windows-64-vs2019-large
2563+
expansions:
2564+
NODE_LTS_NAME: hydrogen
2565+
MSVS_VERSION: 2019
2566+
tasks:
2567+
- test-latest-server
2568+
- test-latest-replica_set
2569+
- test-latest-sharded_cluster
2570+
- test-rapid-server
2571+
- test-rapid-replica_set
2572+
- test-rapid-sharded_cluster
2573+
- test-6.0-server
2574+
- test-6.0-replica_set
2575+
- test-6.0-sharded_cluster
2576+
- test-5.0-server
2577+
- test-5.0-replica_set
2578+
- test-5.0-sharded_cluster
2579+
- test-4.4-server
2580+
- test-4.4-replica_set
2581+
- test-4.4-sharded_cluster
2582+
- test-4.2-server
2583+
- test-4.2-replica_set
2584+
- test-4.2-sharded_cluster
2585+
- test-4.0-server
2586+
- test-4.0-replica_set
2587+
- test-4.0-sharded_cluster
2588+
- test-3.6-server
2589+
- test-3.6-replica_set
2590+
- test-3.6-sharded_cluster
2591+
- test-latest-server-v1-api
2592+
- test-tls-support-latest
2593+
- test-tls-support-6.0
2594+
- test-tls-support-5.0
2595+
- test-tls-support-4.4
2596+
- test-tls-support-4.2
25182597
- name: macos-1100
2519-
display_name: MacOS 11 Node Gallium
2598+
display_name: MacOS 11 Node18
25202599
run_on: macos-1100
25212600
expansions:
2522-
NODE_LTS_NAME: gallium
2601+
NODE_LTS_NAME: hydrogen
25232602
CLIENT_ENCRYPTION: true
25242603
tasks:
25252604
- test-rapid-server

.evergreen/generate_evergreen_tasks.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ const fs = require('fs');
22
const yaml = require('js-yaml');
33

44
const MONGODB_VERSIONS = ['latest', 'rapid', '6.0', '5.0', '4.4', '4.2', '4.0', '3.6'];
5-
const NODE_VERSIONS = ['erbium', 'fermium', 'gallium'];
5+
const versions = [
6+
{ codeName: 'erbium', versionNumber: 12 },
7+
{ codeName: 'fermium', versionNumber: 14 },
8+
{ codeName: 'gallium', versionNumber: 16 },
9+
{ codeName: 'hydrogen', versionNumber: 18 }
10+
];
11+
const NODE_VERSIONS = versions.map(({ codeName }) => codeName)
612
NODE_VERSIONS.sort();
713
const LOWEST_LTS = NODE_VERSIONS[0];
814
const LATEST_LTS = NODE_VERSIONS[NODE_VERSIONS.length - 1];
@@ -357,7 +363,8 @@ for (const
357363
});
358364

359365
for (const NODE_LTS_NAME of testedNodeVersions) {
360-
const nodeLtsDisplayName = `Node ${NODE_LTS_NAME[0].toUpperCase()}${NODE_LTS_NAME.slice(1)}`;
366+
const nodeVersionNumber = versions.find(({ codeName }) => codeName === NODE_LTS_NAME).versionNumber;
367+
const nodeLtsDisplayName = `Node${nodeVersionNumber}`;
361368
const name = `${osName}-${NODE_LTS_NAME}`;
362369
const display_name = `${osDisplayName} ${nodeLtsDisplayName}`;
363370
const expansions = { NODE_LTS_NAME };
@@ -376,7 +383,7 @@ for (const
376383

377384
BUILD_VARIANTS.push({
378385
name: 'macos-1100',
379-
display_name: `MacOS 11 Node ${LATEST_LTS[0].toUpperCase()}${LATEST_LTS.slice(1)}`,
386+
display_name: `MacOS 11 Node${versions[versions.length - 1].versionNumber}`,
380387
run_on: 'macos-1100',
381388
expansions: {
382389
NODE_LTS_NAME: LATEST_LTS,
@@ -645,6 +652,22 @@ for (const variant of BUILD_VARIANTS.filter(
645652
);
646653
}
647654

655+
// TODO(NODE-4667): debug failing tests on Node18
656+
for (const variant of BUILD_VARIANTS.filter(
657+
variant => variant.expansions && variant.expansions.NODE_LTS_NAME === 'hydrogen'
658+
)) {
659+
variant.tasks = variant.tasks.filter(
660+
name => ![
661+
'test-zstd-compression',
662+
'test-snappy-compression',
663+
'test-atlas-data-lake',
664+
'test-socks5',
665+
'test-socks5-tls',
666+
'test-auth-kerberos'
667+
].includes(name)
668+
);
669+
}
670+
648671
const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.in.yml`, 'utf8'));
649672
fileData.tasks = (fileData.tasks || [])
650673
.concat(BASE_TASKS)

test/integration/client-side-encryption/client_side_encryption.prose.corpus.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const BSON = require('bson');
88
const { EJSON } = require('bson');
99
const { expect } = require('chai');
1010
const { getEncryptExtraOptions } = require('../../tools/utils');
11+
const { installNode18DNSHooks } = require('../../tools/runner/hooks/configuration');
1112

1213
describe('Client Side Encryption Prose Corpus Test', function () {
1314
const metadata = {
@@ -147,6 +148,8 @@ describe('Client Side Encryption Prose Corpus Test', function () {
147148
}
148149
}
149150

151+
installNode18DNSHooks();
152+
150153
before(function () {
151154
// 1. Create a MongoClient without encryption enabled (referred to as ``client``).
152155
client = this.configuration.newClient();

test/integration/client-side-encryption/client_side_encryption.prose.deadlock.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const util = require('util');
77
const fs = require('fs');
88
const path = require('path');
99
const { getEncryptExtraOptions } = require('../../tools/utils');
10+
const { installNode18DNSHooks } = require('../../tools/runner/hooks/configuration');
1011

1112
/* REFERENCE: (note commit hash) */
1213
/* https://github.com/mongodb/specifications/blob/b3beada72ae1c992294ae6a8eea572003a274c35/source/client-side-encryption/tests/README.rst#deadlock-tests */
@@ -92,6 +93,8 @@ function deadlockTests(_metadata) {
9293
const metadata = { ..._metadata, requires: { ..._metadata.requires, auth: 'disabled' } };
9394
metadata.skipReason = 'TODO: NODE-3891 - fix tests broken when AUTH enabled';
9495
describe('Connection Pool Deadlock Prevention', function () {
96+
installNode18DNSHooks();
97+
9598
beforeEach(function () {
9699
try {
97100
const mongodbClientEncryption = this.configuration.mongodbClientEncryption;

test/integration/client-side-encryption/client_side_encryption.prose.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const { EJSON, Binary } = BSON;
1111
const { LEGACY_HELLO_COMMAND } = require('../../../src/constants');
1212
const { MongoNetworkError, MongoServerError } = require('../../../src/error');
1313
const { getEncryptExtraOptions } = require('../../tools/utils');
14+
const { installNode18DNSHooks } = require('../../tools/runner/hooks/configuration');
1415

1516
const getKmsProviders = (localKey, kmipEndpoint, azureEndpoint, gcpEndpoint) => {
1617
const result = BSON.EJSON.parse(process.env.CSFLE_KMS_PROVIDERS || '{}');
@@ -69,6 +70,8 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
6970
'base64'
7071
);
7172

73+
installNode18DNSHooks();
74+
7275
describe('Data key and double encryption', function () {
7376
// Data key and double encryption
7477
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/integration/client-side-encryption/client_side_encryption.spec.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from 'path';
22

33
import { loadSpecTests } from '../../spec';
4+
import { installNode18DNSHooks } from '../../tools/runner/hooks/configuration';
45
import {
56
gatherTestSuites,
67
generateTopologyTests,
@@ -69,6 +70,9 @@ describe('Client Side Encryption (Legacy)', function () {
6970
path.join(__dirname, '../../spec/client-side-encryption/tests/legacy'),
7071
testContext
7172
);
73+
74+
installNode18DNSHooks();
75+
7276
after(() => testContext.teardown());
7377
before(function () {
7478
return testContext.setup(this.configuration);
@@ -80,5 +84,6 @@ describe('Client Side Encryption (Legacy)', function () {
8084
});
8185

8286
describe('Client Side Encryption (Unified)', function () {
87+
installNode18DNSHooks();
8388
runUnifiedSuite(loadSpecTests(path.join('client-side-encryption', 'tests', 'unified')));
8489
});

test/integration/client-side-encryption/driver.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as crypto from 'crypto';
44

55
import { Collection, CommandStartedEvent, MongoClient } from '../../../src';
66
import * as BSON from '../../../src/bson';
7+
import { installNode18DNSHooks } from '../../tools/runner/hooks/configuration';
78
import { ClientEncryption } from '../../tools/unified-spec-runner/schema';
89
import { getEncryptExtraOptions } from '../../tools/utils';
910

@@ -21,6 +22,8 @@ describe('Client Side Encryption Functional', function () {
2122
const keyVaultCollName = 'datakeys';
2223
const keyVaultNamespace = `${keyVaultDbName}.${keyVaultCollName}`;
2324

25+
installNode18DNSHooks();
26+
2427
it('CSFLE_KMS_PROVIDERS should be valid EJSON', function () {
2528
const CSFLE_KMS_PROVIDERS = process.env.CSFLE_KMS_PROVIDERS;
2629
if (typeof CSFLE_KMS_PROVIDERS === 'string') {

test/integration/crud/misc_cursors.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ describe('Cursor', function () {
254254
.find({ qty: { $gt: 4 } });
255255
await cursor.count({ readPreference: ReadPreference.SECONDARY });
256256

257-
const selectedServerAddress = bag[0].address.replace('127.0.0.1', 'localhost');
257+
const selectedServerAddress = bag[0].address
258+
.replace('127.0.0.1', 'localhost')
259+
.replace('[::1]', 'localhost');
258260
const selectedServer = client.topology.description.servers.get(selectedServerAddress);
259261
expect(selectedServer).property('type').to.equal(ServerType.RSSecondary);
260262
}

test/integration/node-specific/ipv6.test.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as process from 'process';
44
import * as sinon from 'sinon';
55

66
import { ConnectionCreatedEvent, MongoClient, ReadPreference, TopologyType } from '../../../src';
7-
import { byStrings, sorted } from '../../tools/utils';
87

98
describe('IPv6 Addresses', () => {
109
let client: MongoClient;
@@ -48,17 +47,20 @@ describe('IPv6 Addresses', () => {
4847
});
4948

5049
it('should successfully connect using IPv6 loopback addresses', async function () {
51-
const localhostHosts = this.configuration.options.hostAddresses.map(
50+
const localhostHosts: string[] = this.configuration.options.hostAddresses.map(
5251
({ port }) => `localhost:${port}` // ::1 will be swapped out for localhost
5352
);
5453
await client.db().command({ ping: 1 });
5554
// After running the first command we should receive the hosts back as reported by the mongod in a hello response
5655
// mongodb will report the bound host address, in this case "localhost"
5756
expect(client.topology).to.exist;
57+
5858
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59-
expect(sorted(client.topology!.s.description.servers.keys(), byStrings)).to.deep.equal(
60-
localhostHosts
61-
);
59+
const hosts = Array.from(client.topology!.s.description.servers.keys());
60+
61+
for (const key of localhostHosts) {
62+
expect(hosts).to.include(key);
63+
}
6264
});
6365

6466
it('should createConnection with IPv6 addresses initially then switch to mongodb bound addresses', async () => {
@@ -71,24 +73,15 @@ describe('IPv6 Addresses', () => {
7173

7274
const callArgs = createConnectionSpy.getCalls().map(({ args }) => args[0]);
7375

74-
// This is 7 because we create 3 monitoring connections with ::1, then another 3 with localhost
75-
// and then 1 more in the connection pool for the operation, that is why we are checking for the connectionCreated event
76-
expect(callArgs).to.be.lengthOf(7);
77-
expect(connectionCreatedEvents).to.have.lengthOf(1);
78-
expect(connectionCreatedEvents[0]).to.have.property('address').that.includes('localhost');
79-
80-
for (let index = 0; index < 3; index++) {
76+
for (let index = 0; index < ipv6Hosts.length; index++) {
8177
// The first 3 connections (monitoring) are made using the user provided addresses
8278
expect(callArgs[index]).to.have.property('host', '::1');
8379
}
8480

85-
for (let index = 3; index < 6; index++) {
81+
for (let index = ipv6Hosts.length; index < callArgs.length; index++) {
8682
// MongoDB sends back hellos that have the bound address 'localhost'
8783
// We make new connection using that address instead
8884
expect(callArgs[index]).to.have.property('host', 'localhost');
8985
}
90-
91-
// Operation connection
92-
expect(callArgs[6]).to.have.property('host', 'localhost');
9386
});
9487
});

test/integration/server-selection/server_selection.prose.operation_count.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { on } from 'events';
44
import { CommandStartedEvent } from '../../../src';
55
import { Collection } from '../../../src/collection';
66
import { MongoClient } from '../../../src/mongo_client';
7+
import { installNode18DNSHooks } from '../../tools/runner/hooks/configuration';
78
import { sleep } from '../../tools/utils';
89

910
const failPoint = {
@@ -49,6 +50,8 @@ describe('operationCount-based Selection Within Latency Window - Prose Test', fu
4950
counts[mongosPort] = count + 1;
5051
};
5152

53+
installNode18DNSHooks();
54+
5255
beforeEach(async function () {
5356
// Step 3: Create a client with both mongoses' addresses in its seed list, appName="loadBalancingTest", and localThresholdMS=30000.
5457
const uri = this.configuration.url({

0 commit comments

Comments
 (0)