23
23
##############
24
24
25
25
ALL_VERSIONS = ["4.0" , "4.4" , "5.0" , "6.0" , "7.0" , "8.0" , "rapid" , "latest" ]
26
- VERSIONS_6_0_PLUS = ["6.0" , "7.0" , "8.0" , "rapid" , "latest" ]
27
26
CPYTHONS = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
28
27
PYPYS = ["pypy3.9" , "pypy3.10" ]
29
28
ALL_PYTHONS = CPYTHONS + PYPYS
@@ -55,6 +54,8 @@ class Host:
55
54
HOSTS ["win32" ] = Host ("win32" , "windows-64-vsMulti-small" , "Win32" )
56
55
HOSTS ["macos" ] = Host ("macos" , "macos-14" , "macOS" )
57
56
HOSTS ["macos-arm64" ] = Host ("macos-arm64" , "macos-14-arm64" , "macOS Arm64" )
57
+ HOSTS ["ubuntu20" ] = Host ("ubuntu20" , "ubuntu2004-small" , "Ubuntu-20" )
58
+ HOSTS ["ubuntu22" ] = Host ("ubuntu22" , "ubuntu2204-small" , "Ubuntu-22" )
58
59
59
60
60
61
##############
@@ -103,7 +104,7 @@ def get_python_binary(python: str, host: str) -> str:
103
104
python = python .replace ("." , "" )
104
105
return f"{ base } /Python{ python } /python.exe"
105
106
106
- if host == "rhel8" :
107
+ if host in [ "rhel8" , "ubuntu22" , "ubuntu20" ] :
107
108
return f"/opt/python/{ python } /bin/python3"
108
109
109
110
if host in ["macos" , "macos-arm64" ]:
@@ -112,6 +113,24 @@ def get_python_binary(python: str, host: str) -> str:
112
113
raise ValueError (f"no match found for python { python } on { host } " )
113
114
114
115
116
+ def get_versions_from (min_version : str ) -> list [str ]:
117
+ """Get all server versions starting from a minimum version."""
118
+ min_version_float = float (min_version )
119
+ rapid_latest = ["rapid" , "latest" ]
120
+ versions = [v for v in ALL_VERSIONS if v not in rapid_latest ]
121
+ return [v for v in versions if float (v ) >= min_version_float ] + rapid_latest
122
+
123
+
124
+ def get_versions_until (max_version : str ) -> list [str ]:
125
+ """Get all server version up to a max version."""
126
+ max_version_float = float (max_version )
127
+ versions = [v for v in ALL_VERSIONS if v not in ["rapid" , "latest" ]]
128
+ versions = [v for v in versions if float (v ) <= max_version_float ]
129
+ if not len (versions ):
130
+ raise ValueError (f"No server versions found less <= { max_version } " )
131
+ return versions
132
+
133
+
115
134
def get_display_name (base : str , host : str , ** kwargs ) -> str :
116
135
"""Get the display name of a variant."""
117
136
display_name = f"{ base } { HOSTS [host ].display_name } "
@@ -236,14 +255,17 @@ def create_server_variants() -> list[BuildVariant]:
236
255
237
256
# Test a subset on each of the other platforms.
238
257
for host in ("macos" , "macos-arm64" , "win64" , "win32" ):
239
- for (python , (auth , ssl ), topology ), sync in product (
240
- zip_cycle (MIN_MAX_PYTHON , AUTH_SSLS , TOPOLOGIES ), SYNCS
241
- ):
258
+ for (
259
+ python ,
260
+ sync ,
261
+ (auth , ssl ),
262
+ ) in product (MIN_MAX_PYTHON , SYNCS , AUTH_SSLS ):
242
263
test_suite = "default" if sync == "sync" else "default_async"
264
+ topology = TOPOLOGIES [0 ] if python == CPYTHONS [0 ] else TOPOLOGIES [- 1 ]
243
265
tasks = [f".{ topology } " ]
244
266
# MacOS arm64 only works on server versions 6.0+
245
267
if host == "macos-arm64" :
246
- tasks = [f".{ topology } .{ version } " for version in VERSIONS_6_0_PLUS ]
268
+ tasks = [f".{ topology } .{ version } " for version in get_versions_from ( "6.0" ) ]
247
269
expansions = dict (AUTH = auth , SSL = ssl , TEST_SUITES = test_suite , SKIP_CSOT_TESTS = "true" )
248
270
display_name = get_display_name ("Test" , host , python = python , ** expansions )
249
271
variant = create_variant (
@@ -330,7 +352,7 @@ def create_load_balancer_variants():
330
352
task_names = ["load-balancer-test" ]
331
353
batchtime = BATCHTIME_WEEK
332
354
expansions_base = dict (test_loadbalancer = "true" )
333
- versions = [ "6.0" , "7.0" , "8.0" , "latest" , "rapid" ]
355
+ versions = get_versions_from ( "6.0" )
334
356
variants = []
335
357
pythons = CPYTHONS + PYPYS
336
358
for ind , (version , (auth , ssl )) in enumerate (product (versions , AUTH_SSLS )):
@@ -442,10 +464,186 @@ def create_pyopenssl_variants():
442
464
return variants
443
465
444
466
467
+ def create_storage_engine_tests ():
468
+ host = "rhel8"
469
+ engines = ["InMemory" , "MMAPv1" ]
470
+ variants = []
471
+ for engine in engines :
472
+ python = CPYTHONS [0 ]
473
+ expansions = dict (STORAGE_ENGINE = engine .lower ())
474
+ if engine == engines [0 ]:
475
+ tasks = [f".standalone .{ v } " for v in ALL_VERSIONS ]
476
+ else :
477
+ # MongoDB 4.2 drops support for MMAPv1
478
+ versions = get_versions_until ("4.0" )
479
+ tasks = [f".standalone .{ v } " for v in versions ] + [
480
+ f".replica_set .{ v } " for v in versions
481
+ ]
482
+ display_name = get_display_name (f"Storage { engine } " , host , python = python )
483
+ variant = create_variant (
484
+ tasks , display_name , host = host , python = python , expansions = expansions
485
+ )
486
+ variants .append (variant )
487
+ return variants
488
+
489
+
490
+ def create_versioned_api_tests ():
491
+ host = "rhel8"
492
+ tags = ["versionedApi_tag" ]
493
+ tasks = [f".standalone .{ v } " for v in get_versions_from ("5.0" )]
494
+ variants = []
495
+ types = ["require v1" , "accept v2" ]
496
+
497
+ # All python versions across platforms.
498
+ for python , test_type in product (MIN_MAX_PYTHON , types ):
499
+ expansions = dict (AUTH = "auth" )
500
+ # Test against a cluster with requireApiVersion=1.
501
+ if test_type == types [0 ]:
502
+ # REQUIRE_API_VERSION is set to make drivers-evergreen-tools
503
+ # start a cluster with the requireApiVersion parameter.
504
+ expansions ["REQUIRE_API_VERSION" ] = "1"
505
+ # MONGODB_API_VERSION is the apiVersion to use in the test suite.
506
+ expansions ["MONGODB_API_VERSION" ] = "1"
507
+ else :
508
+ # Test against a cluster with acceptApiVersion2 but without
509
+ # requireApiVersion, and don't automatically add apiVersion to
510
+ # clients created in the test suite.
511
+ expansions ["ORCHESTRATION_FILE" ] = "versioned-api-testing.json"
512
+ base_display_name = f"Versioned API { test_type } "
513
+ display_name = get_display_name (base_display_name , host , python = python , ** expansions )
514
+ variant = create_variant (
515
+ tasks , display_name , host = host , python = python , tags = tags , expansions = expansions
516
+ )
517
+ variants .append (variant )
518
+
519
+ return variants
520
+
521
+
522
+ def create_green_framework_variants ():
523
+ variants = []
524
+ tasks = [".standalone" ]
525
+ host = "rhel8"
526
+ for python , framework in product ([CPYTHONS [0 ], CPYTHONS [- 2 ]], ["eventlet" , "gevent" ]):
527
+ expansions = dict (GREEN_FRAMEWORK = framework , AUTH = "auth" , SSL = "ssl" )
528
+ display_name = get_display_name (f"{ framework .capitalize ()} " , host , python = python )
529
+ variant = create_variant (
530
+ tasks , display_name , host = host , python = python , expansions = expansions
531
+ )
532
+ variants .append (variant )
533
+ return variants
534
+
535
+
536
+ def generate_no_c_ext_variants ():
537
+ variants = []
538
+ host = "rhel8"
539
+ for python , topology in zip_cycle (CPYTHONS , TOPOLOGIES ):
540
+ tasks = [f".{ topology } " ]
541
+ expansions = dict ()
542
+ handle_c_ext (C_EXTS [0 ], expansions )
543
+ display_name = get_display_name ("No C Ext" , host , python = python )
544
+ variant = create_variant (
545
+ tasks , display_name , host = host , python = python , expansions = expansions
546
+ )
547
+ variants .append (variant )
548
+ return variants
549
+
550
+
551
+ def generate_atlas_data_lake_variants ():
552
+ variants = []
553
+ host = "rhel8"
554
+ for python , c_ext in product (MIN_MAX_PYTHON , C_EXTS ):
555
+ tasks = ["atlas-data-lake-tests" ]
556
+ expansions = dict ()
557
+ handle_c_ext (c_ext , expansions )
558
+ display_name = get_display_name ("Atlas Data Lake" , host , python = python , ** expansions )
559
+ variant = create_variant (
560
+ tasks , display_name , host = host , python = python , expansions = expansions
561
+ )
562
+ variants .append (variant )
563
+ return variants
564
+
565
+
566
+ def generate_mod_wsgi_variants ():
567
+ variants = []
568
+ host = "ubuntu22"
569
+ tasks = [
570
+ "mod-wsgi-standalone" ,
571
+ "mod-wsgi-replica-set" ,
572
+ "mod-wsgi-embedded-mode-standalone" ,
573
+ "mod-wsgi-embedded-mode-replica-set" ,
574
+ ]
575
+ expansions = dict (MOD_WSGI_VERSION = "4" )
576
+ for python in MIN_MAX_PYTHON :
577
+ display_name = get_display_name ("mod_wsgi" , host , python = python )
578
+ variant = create_variant (
579
+ tasks , display_name , host = host , python = python , expansions = expansions
580
+ )
581
+ variants .append (variant )
582
+ return variants
583
+
584
+
585
+ def generate_disable_test_commands_variants ():
586
+ host = "rhel8"
587
+ expansions = dict (AUTH = "auth" , SSL = "ssl" , DISABLE_TEST_COMMANDS = "1" )
588
+ python = CPYTHONS [0 ]
589
+ display_name = get_display_name ("Disable test commands" , host , python = python )
590
+ tasks = [".latest" ]
591
+ return [create_variant (tasks , display_name , host = host , python = python , expansions = expansions )]
592
+
593
+
594
+ def generate_serverless_variants ():
595
+ host = "rhel8"
596
+ batchtime = BATCHTIME_WEEK
597
+ expansions = dict (test_serverless = "true" , AUTH = "auth" , SSL = "ssl" )
598
+ tasks = ["serverless_task_group" ]
599
+ base_name = "Serverless"
600
+ return [
601
+ create_variant (
602
+ tasks ,
603
+ get_display_name (base_name , host , python = python ),
604
+ host = host ,
605
+ python = python ,
606
+ expansions = expansions ,
607
+ batchtime = batchtime ,
608
+ )
609
+ for python in MIN_MAX_PYTHON
610
+ ]
611
+
612
+
613
+ def generate_aws_auth_variants ():
614
+ variants = []
615
+ tasks = [
616
+ "aws-auth-test-4.4" ,
617
+ "aws-auth-test-5.0" ,
618
+ "aws-auth-test-6.0" ,
619
+ "aws-auth-test-7.0" ,
620
+ "aws-auth-test-8.0" ,
621
+ "aws-auth-test-rapid" ,
622
+ "aws-auth-test-latest" ,
623
+ ]
624
+
625
+ for host , python in product (["ubuntu20" , "win64" , "macos" ], MIN_MAX_PYTHON ):
626
+ expansions = dict ()
627
+ if host != "ubuntu20" :
628
+ expansions ["skip_ECS_auth_test" ] = "true"
629
+ if host == "macos" :
630
+ expansions ["skip_EC2_auth_test" ] = "true"
631
+ expansions ["skip_web_identity_auth_test" ] = "true"
632
+ variant = create_variant (
633
+ tasks ,
634
+ get_display_name ("AWS Auth" , host , python = python ),
635
+ host = host ,
636
+ python = python ,
637
+ expansions = expansions ,
638
+ )
639
+ variants .append (variant )
640
+ return variants
641
+
642
+
445
643
##################
446
644
# Generate Config
447
645
##################
448
646
449
- variants = create_pyopenssl_variants ()
647
+ variants = create_server_variants ()
450
648
# print(len(variants))
451
649
generate_yaml (variants = variants )
0 commit comments