Debian Codegraph @

.evergreen/config_generator/etc/cse/test.py

raw symbols SCIP
1 from itertools import product
2
3 from shrub.v3.evg_command import KeyValueParam, expansions_update
4 from shrub.v3.evg_task import EvgTask, EvgTaskDependency
5
6 from config_generator.components.funcs.bootstrap_mongo_orchestration import BootstrapMongoOrchestration
7 from config_generator.components.funcs.csfle_setup import CSFLESetup
8 from config_generator.components.funcs.csfle_teardown import CSFLETeardown
9 from config_generator.components.funcs.fetch_build import FetchBuild
10 from config_generator.components.funcs.fetch_det import FetchDET
11 from config_generator.components.funcs.run_tests import RunTests
12 from config_generator.etc.distros import compiler_to_vars, find_large_distro, find_small_distro, make_distro_str
13
14
15 def generate_test_tasks(SSL, TAG, MATRIX):
16 res = []
17
18 TOPOLOGY_TO_STR = {
19 'server': 'server',
20 'replica': 'replica_set',
21 'sharded': 'sharded_cluster',
22 }
23
24 for distro_name, compiler, arch, sasl, auths, topologies, server_vers in MATRIX:
25 tags = [TAG, 'test', distro_name, compiler, f'sasl-{sasl}', 'cse']
26 if distro_name == 'rhel8-latest':
27 test_distro = find_large_distro(distro_name) # DEVPROD-18763
28 else:
29 test_distro = find_small_distro(distro_name)
30
31 compile_vars = []
32 compile_vars = [KeyValueParam(key=key, value=value) for key, value in compiler_to_vars(compiler).items()]
33
34 if arch:
35 tags.append(arch)
36 compile_vars.append(KeyValueParam(key='MARCH', value=arch))
37
38 distro_str = make_distro_str(distro_name, compiler, arch)
39 compile_task_name = f'cse-sasl-{sasl}-{SSL}-{distro_str}-compile'
40
41 for auth, topology, server_ver in product(auths, topologies, server_vers):
42 test_tags = tags + [auth, topology, server_ver]
43 # Do not add `nossl` tag to prevent being selected by legacy config variants.
44 # Remove the `if` when CDRIVER-4571 is resolved.
45 if SSL != 'nossl':
46 test_tags += [SSL]
47 test_task_name = f'cse-sasl-{sasl}-{SSL}-{distro_str}-test-{server_ver}-{topology}-{auth}'
48
49 test_commands = []
50 test_commands.append(FetchBuild.call(build_name=compile_task_name))
51
52 updates = compile_vars + [
53 KeyValueParam(key='AUTH', value=auth),
54 KeyValueParam(key='MONGODB_VERSION', value=server_ver),
55 KeyValueParam(key='TOPOLOGY', value=TOPOLOGY_TO_STR[topology]),
56 KeyValueParam(key='SSL', value=SSL),
57 ]
58
59 test_commands.append(expansions_update(updates=updates))
60 test_commands.append(FetchDET.call())
61 test_commands.append(BootstrapMongoOrchestration.call())
62 test_commands.append(CSFLESetup.call())
63 test_commands.append(RunTests.call())
64 test_commands.append(CSFLETeardown.call())
65
66 res.append(
67 EvgTask(
68 name=test_task_name,
69 run_on=test_distro.name,
70 tags=test_tags,
71 depends_on=[EvgTaskDependency(name=compile_task_name)],
72 commands=test_commands,
73 )
74 )
75
76 return res