-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathgenerate_evergreen_tasks.js
912 lines (843 loc) · 23.9 KB
/
generate_evergreen_tasks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
const fs = require('fs');
const yaml = require('js-yaml');
const semver = require('semver');
const {
MONGODB_VERSIONS,
versions,
NODE_VERSIONS,
LB_VERSIONS,
LOWEST_LTS,
LATEST_LTS,
TOPOLOGIES,
AWS_AUTH_VERSIONS,
TLS_VERSIONS,
DEFAULT_OS,
WINDOWS_OS,
MACOS_OS,
UBUNTU_OS,
UBUNTU_20_OS,
DEBIAN_OS,
UBUNTU_22_OS
} = require('./ci_matrix_constants');
const OPERATING_SYSTEMS = [
{
name: DEFAULT_OS,
display_name: 'rhel8',
run_on: DEFAULT_OS
},
{
name: WINDOWS_OS,
display_name: 'Windows',
run_on: WINDOWS_OS,
clientEncryption: false // TODO(NODE-3401): Unskip when Windows no longer fails to launch mongocryptd occasionally
}
].map(osConfig => ({
nodeVersion: LOWEST_LTS,
auth: 'auth',
clientEncryption: true,
...osConfig
}));
// TODO: NODE-3060: enable skipped tests on windows except oidc (not supported)
const WINDOWS_SKIP_TAGS = new Set([
'atlas-connect',
'auth',
'load_balancer',
'socks5-csfle',
'oidc'
]);
const TASKS = [];
const SINGLETON_TASKS = [];
/**
* @param {Record<string, any>} expansions - keys become expansion names and values are stringified and become expansion value.
* @returns {{command: 'expansions.update'; type: 'setup'; params: { updates: Array<{key: string, value: string}> } }}
*/
function updateExpansions(expansions) {
const updates = Object.entries(expansions).map(([key, value]) => ({ key, value: `${value}` }));
return {
command: 'expansions.update',
type: 'setup',
params: { updates }
};
}
function makeTask({ mongoVersion, topology, tags = [], auth = 'auth' }) {
return {
name: `test-${mongoVersion}-${topology}${auth === 'noauth' ? '-noauth' : ''}`,
tags: [mongoVersion, topology, ...tags],
commands: [
updateExpansions({ VERSION: mongoVersion, TOPOLOGY: topology, AUTH: auth }),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run tests' }
]
};
}
function generateVersionTopologyMatrix() {
function* _generate() {
for (const mongoVersion of MONGODB_VERSIONS) {
for (const topology of TOPOLOGIES) {
yield { mongoVersion, topology };
}
}
}
return Array.from(_generate());
}
const BASE_TASKS = generateVersionTopologyMatrix().map(makeTask);
const AUTH_DISABLED_TASKS = generateVersionTopologyMatrix().map(test =>
makeTask({ ...test, auth: 'noauth', tags: ['noauth'] })
);
BASE_TASKS.push({
name: `test-latest-server-v1-api`,
tags: ['latest', 'server', 'v1-api'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'server',
REQUIRE_API_VERSION: '1',
MONGODB_API_VERSION: '1',
AUTH: 'auth',
TEST_CSFLE: 'true',
CLIENT_ENCRYPTION: 'true'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run tests' }
]
});
BASE_TASKS.push({
name: `test-x509-authentication`,
tags: ['latest', 'auth', 'x509'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'sharded_cluster',
AUTH: 'noauth',
SSL: 'ssl'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run x509 auth tests' }
]
});
// manually added tasks
TASKS.push(
...[
{
name: 'test-atlas-connectivity',
tags: ['atlas-connect'],
commands: [{ func: 'install dependencies' }, { func: 'run atlas tests' }]
},
...LB_VERSIONS.map(ver => ({
name: `test-${ver}-load-balanced`,
tags: ['latest', 'sharded_cluster', 'load_balancer'],
commands: [
updateExpansions({
VERSION: ver,
TOPOLOGY: 'sharded_cluster',
AUTH: 'auth',
LOAD_BALANCER: 'true',
CLIENT_ENCRYPTION: 'false',
TEST_CSFLE: 'false'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'start-load-balancer' },
{ func: 'run-lb-tests' },
{ func: 'stop-load-balancer' }
]
})),
{
name: 'test-auth-kerberos',
tags: ['auth', 'kerberos'],
commands: [
updateExpansions({
NATIVE: 'true'
}),
{ func: 'install dependencies' },
{ func: 'run kerberos tests' }
]
},
{
name: 'test-auth-ldap',
tags: ['auth', 'ldap'],
commands: [{ func: 'install dependencies' }, { func: 'run ldap tests' }]
},
{
name: 'test-socks5',
tags: [],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run socks5 tests' }
]
},
{
name: 'test-socks5-csfle',
tags: ['socks5-csfle'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set',
TEST_SOCKS5_CSFLE: 'true'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run socks5 tests' }
]
},
{
name: 'test-socks5-tls',
tags: [],
commands: [
updateExpansions({
SSL: 'ssl',
VERSION: 'latest',
TOPOLOGY: 'replica_set'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run socks5 tests' }
]
}
]
);
TASKS.push({
name: `test-snappy-compression`,
tags: ['latest', 'snappy'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set',
AUTH: 'auth',
COMPRESSOR: 'snappy',
CLIENT_ENCRYPTION: 'false',
TEST_CSFLE: 'false'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run-compression-tests' }
]
});
TASKS.push({
name: `test-zstd-1.x-compression`,
tags: ['latest', 'zstd'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set',
AUTH: 'auth',
COMPRESSOR: 'zstd',
CLIENT_ENCRYPTION: 'false',
TEST_CSFLE: 'false'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{
func: 'install package',
vars: {
PACKAGE: '@mongodb-js/[email protected]'
}
},
{ func: 'run-compression-tests' }
]
});
TASKS.push({
name: `test-zstd-2.x-compression`,
tags: ['latest', 'zstd'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set',
AUTH: 'auth',
COMPRESSOR: 'zstd',
CLIENT_ENCRYPTION: 'false',
TEST_CSFLE: 'false'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
// no need to manually install zstd - we specify 2.x as a dev dependency in package.json
{ func: 'run-compression-tests' }
]
});
const AWS_LAMBDA_HANDLER_TASKS = [];
// Add task for testing lambda example without aws auth.
AWS_LAMBDA_HANDLER_TASKS.push({
name: 'test-lambda-example',
tags: ['latest', 'lambda'],
commands: [
updateExpansions({
NPM_VERSION: 9,
VERSION: 'rapid',
TOPOLOGY: 'server'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run lambda handler example tests' }
]
});
// Add task for testing lambda example with aws auth.
AWS_LAMBDA_HANDLER_TASKS.push({
name: 'test-lambda-aws-auth-example',
tags: ['latest', 'lambda'],
commands: [
updateExpansions({
NPM_VERSION: 9,
VERSION: 'rapid',
AUTH: 'auth',
ORCHESTRATION_FILE: 'auth-aws.json',
TOPOLOGY: 'server'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'assume secrets manager rule' },
{ func: 'run lambda handler example tests with aws auth' }
]
});
for (const VERSION of TLS_VERSIONS) {
TASKS.push({
name: `test-tls-support-${VERSION}`,
tags: ['tls-support'],
commands: [
updateExpansions({
VERSION,
SSL: 'ssl',
TOPOLOGY: 'server'
// TODO: NODE-3891 - fix tests broken when AUTH enabled
// AUTH: 'auth'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run tls tests' }
]
});
}
const AWS_AUTH_TASKS = [];
for (const VERSION of AWS_AUTH_VERSIONS) {
const name = ex => `aws-${VERSION}-auth-test-${ex.split(' ').join('-')}`;
const awsFuncs = [
{ func: 'run aws auth test with regular aws credentials' },
{ func: 'run aws auth test with assume role credentials' },
{ func: 'run aws auth test with aws EC2 credentials', onlySdk: true },
{ func: 'run aws auth test with aws credentials as environment variables' },
{ func: 'run aws auth test with aws credentials and session token as environment variables' },
{ func: 'run aws ECS auth test' },
{
func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME unset',
onlySdk: true
},
{
func: 'run aws auth test AssumeRoleWithWebIdentity with AWS_ROLE_SESSION_NAME set',
onlySdk: true
}
];
const awsTasks = awsFuncs.map(fn => ({
name: name(fn.func),
commands: [
updateExpansions({
VERSION,
AUTH: 'auth',
ORCHESTRATION_FILE: 'auth-aws.json',
TOPOLOGY: 'server',
MONGODB_AWS_SDK: 'true'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'assume secrets manager rule' },
{ func: fn.func }
]
}));
const awsNoPeerDependenciesTasks = awsFuncs
.filter(fn => fn.onlySdk !== true)
.map(fn => ({
name: `${name(fn.func)}-no-peer-dependencies`,
commands: [
updateExpansions({
VERSION: VERSION,
AUTH: 'auth',
ORCHESTRATION_FILE: 'auth-aws.json',
TOPOLOGY: 'server',
MONGODB_AWS_SDK: 'false'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'assume secrets manager rule' },
{ func: fn.func }
]
}));
const allAwsTasks = awsTasks.concat(awsNoPeerDependenciesTasks);
TASKS.push(...allAwsTasks);
AWS_AUTH_TASKS.push(...allAwsTasks.map(t => t.name));
}
const BUILD_VARIANTS = [];
for (const {
name: osName,
display_name: osDisplayName,
run_on,
nodeVersions = NODE_VERSIONS,
clientEncryption
} of OPERATING_SYSTEMS) {
const testedNodeVersions = NODE_VERSIONS.filter(version => nodeVersions.includes(version));
const os = osName.split('-')[0];
const tasks = BASE_TASKS.concat(TASKS).filter(task => {
const isAWSTask = task.name.match(/^aws/);
const isSkippedTaskOnWindows =
task.tags &&
os.match(/^windows/) &&
task.tags.filter(tag => WINDOWS_SKIP_TAGS.has(tag)).length;
return !isAWSTask && !isSkippedTaskOnWindows;
});
for (const NODE_LTS_VERSION of testedNodeVersions) {
const nodeLTSCodeName = versions.find(
({ versionNumber }) => versionNumber === NODE_LTS_VERSION
).codeName;
const nodeLtsDisplayName = `Node${NODE_LTS_VERSION}`;
const name = `${osName}-${NODE_LTS_VERSION >= 20 ? nodeLtsDisplayName : nodeLTSCodeName}`;
const display_name = `${osDisplayName} ${nodeLtsDisplayName}`;
const NPM_VERSION = versions.find(
({ versionNumber }) => versionNumber === NODE_LTS_VERSION
).npmVersion;
const expansions = { NODE_LTS_VERSION, NPM_VERSION };
const taskNames = tasks.map(({ name }) => name);
expansions.CLIENT_ENCRYPTION = String(!!clientEncryption);
expansions.TEST_CSFLE = expansions.CLIENT_ENCRYPTION;
BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks: taskNames });
}
const configureLatestNodeSmokeTest = os.match(/^rhel/);
if (configureLatestNodeSmokeTest) {
const buildVariantData = {
name: `${osName}-node-latest`,
display_name: `${osDisplayName} Node Latest`,
run_on,
expansions: { NODE_LTS_VERSION: 'latest' },
tasks: tasks.map(({ name }) => name),
};
if (clientEncryption) {
buildVariantData.expansions.CLIENT_ENCRYPTION = true;
}
BUILD_VARIANTS.push(buildVariantData);
}
}
// Running CSFLE tests with mongocryptd
const MONGOCRYPTD_CSFLE_TASKS = MONGODB_VERSIONS.filter(
mongoVersion =>
['latest', 'rapid'].includes(mongoVersion) || semver.gte(`${mongoVersion}.0`, '4.2.0')
).map(mongoVersion => {
return {
name: `test-${mongoVersion}-csfle-mongocryptd`,
tags: [mongoVersion, 'sharded_cluster'],
commands: [
updateExpansions({
VERSION: mongoVersion,
TOPOLOGY: 'sharded_cluster',
AUTH: 'auth'
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'run tests' }
]
};
});
for (const nodeVersion of [LOWEST_LTS, LATEST_LTS]) {
const name = `rhel8-node${nodeVersion}-test-csfle-mongocryptd`;
const displayName = `rhel 8 Node${nodeVersion} test mongocryptd`;
BUILD_VARIANTS.push({
name,
display_name: displayName,
run_on: DEFAULT_OS,
expansions: {
CLIENT_ENCRYPTION: true,
RUN_WITH_MONGOCRYPTD: true,
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9
},
tasks: MONGOCRYPTD_CSFLE_TASKS.map(task => task.name)
});
}
BUILD_VARIANTS.push({
name: MACOS_OS,
display_name: `MacOS 14 ARM Node${LATEST_LTS}`,
run_on: MACOS_OS,
expansions: {
NODE_LTS_VERSION: LATEST_LTS,
CLIENT_ENCRYPTION: true
},
tasks: ['test-rapid-server']
});
const unitTestTasks = Array.from(
(function* () {
for (const { versionNumber: NODE_LTS_VERSION, npmVersion: NPM_VERSION } of versions) {
yield {
name: `run-unit-tests-node-${NODE_LTS_VERSION}`,
tags: ['unit-tests'],
commands: [
updateExpansions({
NODE_LTS_VERSION,
NPM_VERSION
}),
{ func: 'install dependencies' },
{ func: 'run unit tests' }
]
};
}
})()
);
// singleton build variant for linting
SINGLETON_TASKS.push(
...[
...unitTestTasks,
{
name: 'run-lint-checks',
tags: ['lint-checks'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9
}),
{ func: 'install dependencies' },
{ func: 'run lint checks' }
]
},
{
name: 'run-resource-management-no-async-dispose',
tags: ['resource-management'],
commands: [
updateExpansions({
NODE_LTS_VERSION: 'v16.20.2',
NPM_VERSION: 9
}),
{ func: 'install dependencies' },
{ func: 'check resource management' }
]
},
{
name: 'run-resource-management-async-dispose',
tags: ['resource-management'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LATEST_LTS,
NPM_VERSION: 9
}),
{ func: 'install dependencies' },
{ func: 'check resource management' }
]
},
{
name: 'test-explicit-resource-management-feature-integration',
tags: ['resource-management'],
commands: [
updateExpansions({
VERSION: 'latest',
TOPOLOGY: 'replica_set',
NODE_LTS_VERSION: LATEST_LTS
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'check resource management feature integration' }
]
},
...Array.from(makeTypescriptTasks())
]
);
function* makeTypescriptTasks() {
function makeCompileTask(TS_VERSION, TYPES_VERSION) {
return {
name: `compile-driver-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
tags: [`compile-driver-typescript-${TS_VERSION}`, 'typescript-compilation'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9,
TS_VERSION,
TYPES_VERSION
}),
{ func: 'install dependencies' },
{ func: 'compile driver' }
]
};
}
function makeCheckTypesTask(TS_VERSION, TYPES_VERSION) {
return {
name: `check-types-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
tags: [`check-types-typescript-${TS_VERSION}`, 'typescript-compilation'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9,
TS_VERSION,
TYPES_VERSION
}),
{ func: 'install dependencies' },
{ func: 'check types' }
]
};
}
const typesVersion = require('../package.json').devDependencies['@types/node'].slice(1);
yield makeCheckTypesTask('next', typesVersion);
yield makeCheckTypesTask('current', typesVersion);
yield makeCheckTypesTask('next', '16.x');
yield makeCheckTypesTask('current', '16.x');
// typescript 4.4 only compiles our types with this particular version
yield makeCheckTypesTask('4.4', '18.11.9');
yield makeCompileTask('current', typesVersion);
}
BUILD_VARIANTS.push({
name: 'lint',
display_name: 'lint',
run_on: DEFAULT_OS,
tasks: ['.unit-tests', '.lint-checks', '.typescript-compilation']
});
BUILD_VARIANTS.push({
name: 'generate-combined-coverage',
display_name: 'Generate Combined Coverage',
run_on: DEFAULT_OS,
tasks: ['download-and-merge-coverage']
});
// special case for MONGODB-AWS authentication
BUILD_VARIANTS.push({
name: 'ubuntu2004-test-mongodb-aws',
display_name: 'MONGODB-AWS Auth test',
run_on: UBUNTU_20_OS,
expansions: {
NODE_LTS_VERSION: LATEST_LTS
},
tasks: AWS_AUTH_TASKS
});
BUILD_VARIANTS.push({
name: 'ubuntu2204-test-atlas-data-lake',
display_name: 'Atlas Data Lake Tests',
run_on: UBUNTU_22_OS,
expansions: {
NODE_LTS_VERSION: LATEST_LTS
},
tasks: ['test-atlas-data-lake']
});
const customDependencyTests = [];
for (const version of ['5.0', 'rapid', 'latest']) {
customDependencyTests.push({
name: `run-custom-csfle-tests-${version}`,
tags: ['run-custom-dependency-tests'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9,
VERSION: version,
TOPOLOGY: 'replica_set',
CLIENT_ENCRYPTION: true
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'install mongodb-client-encryption' },
{ func: 'assume secrets manager rule' },
{ func: 'run custom csfle tests' }
]
});
}
customDependencyTests.push({
name: `test-latest-driver-mongodb-client-encryption-6.0.0`,
tags: ['run-custom-dependency-tests'],
commands: [
updateExpansions({
NODE_LTS_VERSION: LOWEST_LTS,
NPM_VERSION: 9,
VERSION: '7.0',
TOPOLOGY: 'replica_set',
CLIENT_ENCRYPTION: true
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{
func: 'install package',
vars: {
PACKAGE: '[email protected]'
}
},
{ func: 'run tests' }
]
});
const coverageTask = {
name: 'download and merge coverage'.split(' ').join('-'),
tags: [],
commands: [
{
func: 'download and merge coverage'
}
],
depends_on: [
{
name: '*',
variant: '* !performance-tests',
status: '*',
patch_optional: true
}
]
};
SINGLETON_TASKS.push(coverageTask);
SINGLETON_TASKS.push(...customDependencyTests);
SINGLETON_TASKS.push(
{
name: `test-alpine-fle`,
tags: ['alpine-fle'],
commands: [
updateExpansions({
NODE_VERSION: '16.20.1',
VERSION: 'latest',
TOPOLOGY: 'replica_set',
CLIENT_ENCRYPTION: true,
TEST_CSFLE: true,
MONGODB_BINARIES: '${PROJECT_DIRECTORY}/mongodb/bin',
}),
{ func: 'install dependencies' },
{ func: 'bootstrap mongo-orchestration' },
{ func: 'assume secrets manager rule' },
{ func: 'build and test alpine FLE' }
]
}
)
function addPerformanceTasks() {
const makePerfTask = (name, MONGODB_CLIENT_OPTIONS) => ({
name,
tags: ['run-spec-benchmark-tests', 'performance'],
exec_timeout_secs: 7200,
commands: [
updateExpansions({
NODE_LTS_VERSION: 'v22.11.0',
VERSION: 'v6.0-perf',
TOPOLOGY: 'server',
AUTH: 'noauth',
MONGODB_CLIENT_OPTIONS: JSON.stringify(MONGODB_CLIENT_OPTIONS)
}),
...[
'install dependencies',
'bootstrap mongo-orchestration',
'run spec driver benchmarks',
'perf send'
].map(func => ({ func }))
]
});
const tasks = [
makePerfTask('run-spec-benchmark-tests-node-server', {}),
makePerfTask('run-spec-benchmark-tests-node-server-timeoutMS-120000', { timeoutMS: 120000 }),
makePerfTask('run-spec-benchmark-tests-node-server-timeoutMS-0', { timeoutMS: 0 }),
makePerfTask('run-spec-benchmark-tests-node-server-monitorCommands-true', {
monitorCommands: true
}),
makePerfTask('run-spec-benchmark-tests-node-server-logging', {
mongodbLogPath: 'stderr',
mongodbLogComponentSeverities: { default: 'trace' }
})
];
TASKS.push(...tasks);
BUILD_VARIANTS.push({
name: 'performance-tests',
display_name: 'Performance Test',
run_on: 'rhel90-dbx-perf-large',
tasks: tasks.map(({ name }) => name),
tags: ['performance']
});
}
addPerformanceTasks();
BUILD_VARIANTS.push({
name: 'rhel8-custom-dependency-tests',
display_name: 'Custom Dependency Version Test',
run_on: DEFAULT_OS,
tasks: customDependencyTests.map(({ name }) => name)
});
// TODO(NODE-6786): Reenable serverless testing.
// BUILD_VARIANTS.push({
// name: 'rhel8-test-serverless',
// display_name: 'Serverless Test',
// run_on: DEFAULT_OS,
// expansions: {
// NODE_LTS_VERSION: LOWEST_LTS,
// NPM_VERSION: 9
// },
// tasks: ['serverless_task_group']
// });
BUILD_VARIANTS.push({
name: 'rhel8-test-gcp-kms',
display_name: 'GCP KMS Test',
run_on: DEBIAN_OS,
tasks: ['test_gcpkms_task_group', 'test-gcpkms-fail-task']
});
BUILD_VARIANTS.push({
name: 'debian11-test-azure-kms',
display_name: 'Azure KMS Test',
run_on: DEBIAN_OS,
batchtime: 20160,
tasks: ['test_azurekms_task_group', 'test-azurekms-fail-task']
});
BUILD_VARIANTS.push({
name: 'ubuntu20-test-all-oidc',
display_name: 'MONGODB-OIDC Auth Tests',
run_on: UBUNTU_20_OS,
expansions: {
NODE_LTS_VERSION: LATEST_LTS
},
batchtime: 20160,
tasks: [
'testtestoidc_task_group',
'testazureoidc_task_group',
'testgcpoidc_task_group',
'testk8soidc_task_group_eks',
'testk8soidc_task_group_gke',
'testk8soidc_task_group_aks'
]
});
BUILD_VARIANTS.push({
name: 'rhel8-test-atlas',
display_name: 'Atlas Cluster Tests',
run_on: DEFAULT_OS,
tasks: ['test_atlas_task_group']
});
BUILD_VARIANTS.push({
name: 'rhel8-no-auth-tests',
display_name: 'No Auth Tests',
run_on: DEFAULT_OS,
expansions: {
CLIENT_ENCRYPTION: true
},
tasks: AUTH_DISABLED_TASKS.map(({ name }) => name)
});
BUILD_VARIANTS.push({
name: 'rhel8-test-lambda',
display_name: 'AWS Lambda handler tests',
run_on: DEFAULT_OS,
tasks: ['test-lambda-example', 'test-lambda-aws-auth-example']
});
BUILD_VARIANTS.push({
name: 'rhel8-test-search-indexes',
display_name: 'Search Index Tests',
run_on: DEFAULT_OS,
tasks: ['test_atlas_task_group_search_indexes']
});
BUILD_VARIANTS.push({
name: 'resource management tests',
display_name: 'resource management tests',
run_on: DEFAULT_OS,
tasks: ['.resource-management']
});
// TODO(NODE-4897): Debug socks5 tests on node latest
for (const variant of BUILD_VARIANTS.filter(
variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_VERSION)
)) {
variant.tasks = variant.tasks.filter(name => !['test-socks5'].includes(name));
}
const fileData = yaml.load(fs.readFileSync(`${__dirname}/config.in.yml`, 'utf8'));
fileData.tasks = [
...(fileData.tasks ?? []),
...BASE_TASKS,
...TASKS,
...SINGLETON_TASKS,
...AUTH_DISABLED_TASKS,
...AWS_LAMBDA_HANDLER_TASKS,
...MONGOCRYPTD_CSFLE_TASKS
];
fileData.buildvariants = [...(fileData.buildvariants ?? []), ...BUILD_VARIANTS];
fs.writeFileSync(
`${__dirname}/config.yml`,
yaml.dump(fileData, { lineWidth: 120, noRefs: true, flowLevel: 7, condenseFlow: false }),
'utf8'
);