Skip to content

Commit d727ced

Browse files
emadumljhaywar
authored andcommitted
chore(ci): enable tls testing on windows (#2722)
NODE-2977
1 parent 06abe94 commit d727ced

File tree

4 files changed

+148
-47
lines changed

4 files changed

+148
-47
lines changed

.evergreen/config.yml

Lines changed: 92 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -802,17 +802,6 @@ tasks:
802802
commands:
803803
- func: install dependencies
804804
- func: run ldap tests
805-
- name: test-tls-support
806-
tags:
807-
- tls-support
808-
commands:
809-
- func: install dependencies
810-
- func: bootstrap mongo-orchestration
811-
vars:
812-
SSL: ssl
813-
VERSION: latest
814-
TOPOLOGY: server
815-
- func: run tls tests
816805
- name: test-ocsp-valid-cert-server-staples
817806
tags:
818807
- ocsp
@@ -909,6 +898,28 @@ tasks:
909898
- func: run-ocsp-test
910899
vars:
911900
OCSP_TLS_SHOULD_SUCCEED: 0
901+
- name: test-tls-support-latest
902+
tags:
903+
- tls-support
904+
commands:
905+
- func: install dependencies
906+
- func: bootstrap mongo-orchestration
907+
vars:
908+
VERSION: latest
909+
SSL: ssl
910+
TOPOLOGY: server
911+
- func: run tls tests
912+
- name: test-tls-support-4.2
913+
tags:
914+
- tls-support
915+
commands:
916+
- func: install dependencies
917+
- func: bootstrap mongo-orchestration
918+
vars:
919+
VERSION: '4.2'
920+
SSL: ssl
921+
TOPOLOGY: server
922+
- func: run tls tests
912923
- name: test-latest-ocsp-valid-cert-server-staples
913924
tags:
914925
- ocsp
@@ -1188,14 +1199,15 @@ buildvariants:
11881199
- test-atlas-data-lake
11891200
- test-auth-kerberos
11901201
- test-auth-ldap
1191-
- test-tls-support
11921202
- test-ocsp-valid-cert-server-staples
11931203
- test-ocsp-invalid-cert-server-staples
11941204
- test-ocsp-valid-cert-server-does-not-staple
11951205
- test-ocsp-invalid-cert-server-does-not-staple
11961206
- test-ocsp-soft-fail
11971207
- test-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
11981208
- test-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1209+
- test-tls-support-latest
1210+
- test-tls-support-4.2
11991211
- test-latest-ocsp-valid-cert-server-staples
12001212
- test-latest-ocsp-invalid-cert-server-staples
12011213
- test-latest-ocsp-valid-cert-server-does-not-staple
@@ -1221,19 +1233,73 @@ buildvariants:
12211233
run_on: rhel70-small
12221234
expansions:
12231235
NODE_LTS_NAME: dubnium
1224-
tasks: *ref_0
1236+
tasks: &ref_1
1237+
- test-latest-server
1238+
- test-latest-replica_set
1239+
- test-latest-sharded_cluster
1240+
- test-4.4-server
1241+
- test-4.4-replica_set
1242+
- test-4.4-sharded_cluster
1243+
- test-4.2-server
1244+
- test-4.2-replica_set
1245+
- test-4.2-sharded_cluster
1246+
- test-4.0-server
1247+
- test-4.0-replica_set
1248+
- test-4.0-sharded_cluster
1249+
- test-3.6-server
1250+
- test-3.6-replica_set
1251+
- test-3.6-sharded_cluster
1252+
- test-3.4-server
1253+
- test-3.4-replica_set
1254+
- test-3.4-sharded_cluster
1255+
- test-3.2-server
1256+
- test-3.2-replica_set
1257+
- test-3.2-sharded_cluster
1258+
- test-3.0-server
1259+
- test-3.0-replica_set
1260+
- test-3.0-sharded_cluster
1261+
- test-2.6-server
1262+
- test-2.6-replica_set
1263+
- test-2.6-sharded_cluster
1264+
- test-atlas-connectivity
1265+
- test-atlas-data-lake
1266+
- test-auth-kerberos
1267+
- test-auth-ldap
1268+
- test-ocsp-valid-cert-server-staples
1269+
- test-ocsp-invalid-cert-server-staples
1270+
- test-ocsp-valid-cert-server-does-not-staple
1271+
- test-ocsp-invalid-cert-server-does-not-staple
1272+
- test-ocsp-soft-fail
1273+
- test-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
1274+
- test-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1275+
- test-tls-support-latest
1276+
- test-tls-support-4.2
1277+
- test-latest-ocsp-valid-cert-server-staples
1278+
- test-latest-ocsp-invalid-cert-server-staples
1279+
- test-latest-ocsp-valid-cert-server-does-not-staple
1280+
- test-latest-ocsp-invalid-cert-server-does-not-staple
1281+
- test-latest-ocsp-soft-fail
1282+
- test-latest-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
1283+
- test-latest-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1284+
- test-4.4-ocsp-valid-cert-server-staples
1285+
- test-4.4-ocsp-invalid-cert-server-staples
1286+
- test-4.4-ocsp-valid-cert-server-does-not-staple
1287+
- test-4.4-ocsp-invalid-cert-server-does-not-staple
1288+
- test-4.4-ocsp-soft-fail
1289+
- test-4.4-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
1290+
- test-4.4-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
12251291
- name: rhel70-erbium
12261292
display_name: RHEL 7.0 Node Erbium
12271293
run_on: rhel70-small
12281294
expansions:
12291295
NODE_LTS_NAME: erbium
1230-
tasks: *ref_0
1296+
tasks: *ref_1
12311297
- name: ubuntu-14.04-dubnium
12321298
display_name: Ubuntu 14.04 Node Dubnium
12331299
run_on: ubuntu1404-large
12341300
expansions:
12351301
NODE_LTS_NAME: dubnium
1236-
tasks: &ref_1
1302+
tasks: &ref_2
12371303
- test-4.0-server
12381304
- test-4.0-replica_set
12391305
- test-4.0-sharded_cluster
@@ -1261,14 +1327,14 @@ buildvariants:
12611327
run_on: ubuntu1404-large
12621328
expansions:
12631329
NODE_LTS_NAME: erbium
1264-
tasks: *ref_1
1330+
tasks: *ref_2
12651331
- name: ubuntu-18.04-dubnium
12661332
display_name: Ubuntu 18.04 Node Dubnium
12671333
run_on: ubuntu1804-large
12681334
expansions:
12691335
NODE_LTS_NAME: dubnium
12701336
CLIENT_ENCRYPTION: true
1271-
tasks: &ref_2
1337+
tasks: &ref_3
12721338
- test-latest-server
12731339
- test-latest-replica_set
12741340
- test-latest-sharded_cluster
@@ -1294,14 +1360,15 @@ buildvariants:
12941360
- test-atlas-data-lake
12951361
- test-auth-kerberos
12961362
- test-auth-ldap
1297-
- test-tls-support
12981363
- test-ocsp-valid-cert-server-staples
12991364
- test-ocsp-invalid-cert-server-staples
13001365
- test-ocsp-valid-cert-server-does-not-staple
13011366
- test-ocsp-invalid-cert-server-does-not-staple
13021367
- test-ocsp-soft-fail
13031368
- test-ocsp-malicious-invalid-cert-mustStaple-server-does-not-staple
13041369
- test-ocsp-malicious-no-responder-mustStaple-server-does-not-staple
1370+
- test-tls-support-latest
1371+
- test-tls-support-4.2
13051372
- test-latest-ocsp-valid-cert-server-staples
13061373
- test-latest-ocsp-invalid-cert-server-staples
13071374
- test-latest-ocsp-valid-cert-server-does-not-staple
@@ -1322,14 +1389,14 @@ buildvariants:
13221389
expansions:
13231390
NODE_LTS_NAME: erbium
13241391
CLIENT_ENCRYPTION: true
1325-
tasks: *ref_2
1392+
tasks: *ref_3
13261393
- name: windows-64-vs2015-dubnium
13271394
display_name: Windows (VS2015) Node Dubnium
13281395
run_on: windows-64-vs2015-large
13291396
expansions:
13301397
NODE_LTS_NAME: dubnium
13311398
MSVS_VERSION: 2015
1332-
tasks: &ref_3
1399+
tasks: &ref_4
13331400
- test-4.2-server
13341401
- test-4.2-replica_set
13351402
- test-4.2-sharded_cluster
@@ -1351,27 +1418,29 @@ buildvariants:
13511418
- test-2.6-server
13521419
- test-2.6-replica_set
13531420
- test-2.6-sharded_cluster
1421+
- test-atlas-data-lake
1422+
- test-tls-support-4.2
13541423
- name: windows-64-vs2015-erbium
13551424
display_name: Windows (VS2015) Node Erbium
13561425
run_on: windows-64-vs2015-large
13571426
expansions:
13581427
NODE_LTS_NAME: erbium
13591428
MSVS_VERSION: 2015
1360-
tasks: *ref_3
1429+
tasks: *ref_4
13611430
- name: windows-64-vs2017-dubnium
13621431
display_name: Windows (VS2017) Node Dubnium
13631432
run_on: windows-64-vs2017-large
13641433
expansions:
13651434
NODE_LTS_NAME: dubnium
13661435
MSVS_VERSION: 2017
1367-
tasks: *ref_3
1436+
tasks: *ref_4
13681437
- name: windows-64-vs2017-erbium
13691438
display_name: Windows (VS2017) Node Erbium
13701439
run_on: windows-64-vs2017-large
13711440
expansions:
13721441
NODE_LTS_NAME: erbium
13731442
MSVS_VERSION: 2017
1374-
tasks: *ref_3
1443+
tasks: *ref_4
13751444
- name: lint
13761445
display_name: lint
13771446
run_on: rhel70

.evergreen/generate_evergreen_tasks.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const NODE_VERSIONS = ['dubnium', 'erbium'];
88
const TOPOLOGIES = ['server', 'replica_set', 'sharded_cluster'];
99
const AWS_AUTH_VERSIONS = ['latest', '4.4'];
1010
const OCSP_VERSIONS = ['latest', '4.4'];
11+
const TLS_VERSIONS = ['latest', '4.2']; // also test on 4.2 because 4.4+ currently skipped on windows
1112

1213
const OPERATING_SYSTEMS = [
1314
{
@@ -59,6 +60,8 @@ const OPERATING_SYSTEMS = [
5960
)
6061
);
6162

63+
const WINDOWS_SKIP_TAGS = new Set(['atlas-connect', 'auth']);
64+
6265
const TASKS = [];
6366
const SINGLETON_TASKS = [];
6467

@@ -110,22 +113,6 @@ Array.prototype.push.apply(TASKS, [
110113
tags: ['auth', 'ldap'],
111114
commands: [{ func: 'install dependencies' }, { func: 'run ldap tests' }]
112115
},
113-
{
114-
name: 'test-tls-support',
115-
tags: ['tls-support'],
116-
commands: [
117-
{ func: 'install dependencies' },
118-
{
119-
func: 'bootstrap mongo-orchestration',
120-
vars: {
121-
SSL: 'ssl',
122-
VERSION: 'latest',
123-
TOPOLOGY: 'server'
124-
}
125-
},
126-
{ func: 'run tls tests' }
127-
]
128-
},
129116
{
130117
name: 'test-ocsp-valid-cert-server-staples',
131118
tags: ['ocsp'],
@@ -245,6 +232,25 @@ Array.prototype.push.apply(TASKS, [
245232
}
246233
]);
247234

235+
TLS_VERSIONS.forEach(VERSION => {
236+
TASKS.push({
237+
name: `test-tls-support-${VERSION}`,
238+
tags: ['tls-support'],
239+
commands: [
240+
{ func: 'install dependencies' },
241+
{
242+
func: 'bootstrap mongo-orchestration',
243+
vars: {
244+
VERSION,
245+
SSL: 'ssl',
246+
TOPOLOGY: 'server'
247+
}
248+
},
249+
{ func: 'run tls tests' }
250+
]
251+
});
252+
});
253+
248254
OCSP_VERSIONS.forEach(VERSION => {
249255
// manually added tasks
250256
Array.prototype.push.apply(TASKS, [
@@ -401,18 +407,27 @@ const BUILD_VARIANTS = [];
401407

402408
const getTaskList = (() => {
403409
const memo = {};
404-
return function (mongoVersion, onlyBaseTasks = false) {
405-
const key = mongoVersion + (onlyBaseTasks ? 'b' : '');
410+
return function (mongoVersion, os) {
411+
const key = mongoVersion + os;
406412

407413
if (memo[key]) {
408414
return memo[key];
409415
}
410-
const taskList = onlyBaseTasks ? BASE_TASKS : BASE_TASKS.concat(TASKS);
416+
const taskList = BASE_TASKS.concat(TASKS);
411417
const ret = taskList
412418
.filter(task => {
413-
const tasksWithVars = task.commands.filter(task => !!task.vars);
414419
if (task.name.match(/^aws/)) return false;
415420

421+
// skip unsupported tasks on windows
422+
if (
423+
os.match(/^windows/) &&
424+
task.tags &&
425+
task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length
426+
) {
427+
return false;
428+
}
429+
430+
const tasksWithVars = task.commands.filter(task => !!task.vars);
416431
if (!tasksWithVars.length) {
417432
return true;
418433
}
@@ -442,7 +457,7 @@ OPERATING_SYSTEMS.forEach(
442457
msvsVersion
443458
}) => {
444459
const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version));
445-
const tasks = getTaskList(mongoVersion, !!msvsVersion);
460+
const tasks = getTaskList(mongoVersion, osName.split('-')[0]);
446461

447462
testedNodeVersions.forEach(NODE_LTS_NAME => {
448463
const nodeLtsDisplayName = `Node ${NODE_LTS_NAME[0].toUpperCase()}${NODE_LTS_NAME.substr(1)}`;

.evergreen/run-tls-tests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ set -o errexit # Exit the script with error if any of the commands fail
55
export PROJECT_DIRECTORY="$(pwd)"
66
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
77
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
8-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
8+
if [[ "$OS" == "Windows_NT" ]]; then
9+
export NVM_HOME=`cygpath -m -a "$NVM_DIR"`
10+
export NVM_SYMLINK=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
11+
export NVM_ARTIFACTS_PATH=`cygpath -m -a "$NODE_ARTIFACTS_PATH/bin"`
12+
export PATH=`cygpath $NVM_SYMLINK`:`cygpath $NVM_HOME`:$PATH
13+
else
14+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
15+
fi
916
export SSL_KEY_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
1017
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
1118

test/manual/tls_support.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ describe('TLS Support', function () {
1313
const connectionString = process.env.MONGODB_URI;
1414
const tlsCertificateKeyFile = process.env.SSL_KEY_FILE;
1515
const tlsCAFile = process.env.SSL_CA_FILE;
16+
const tlsSettings = { tls: true, tlsCertificateKeyFile, tlsCAFile };
1617

1718
it(
18-
'should connect with tls',
19-
makeConnectionTest(connectionString, { tls: true, tlsCertificateKeyFile, tlsCAFile })
19+
'should connect with tls via client options',
20+
makeConnectionTest(connectionString, tlsSettings)
21+
);
22+
23+
it(
24+
'should connect with tls via url options',
25+
makeConnectionTest(
26+
`${connectionString}?${Object.keys(tlsSettings)
27+
.map(key => `${key}=${tlsSettings[key]}`)
28+
.join('&')}`
29+
)
2030
);
2131
});
2232

0 commit comments

Comments
 (0)