Skip to content

Commit 16015d3

Browse files
committed
wip
1 parent 92970d3 commit 16015d3

File tree

3 files changed

+248
-108
lines changed

3 files changed

+248
-108
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -29,114 +29,6 @@ include:
2929
- filename: .evergreen/generated_configs/tasks.yml
3030
- filename: .evergreen/generated_configs/variants.yml
3131

32-
functions:
33-
"fetch source":
34-
# Executes clone and applies the submitted patch, if any
35-
- command: git.get_project
36-
params:
37-
directory: "src"
38-
# Applies the subitted patch, if any
39-
# Deprecated. Should be removed. But still needed for certain agents (ZAP)
40-
- command: git.apply_patch
41-
42-
"setup system":
43-
# Make an evergreen expansion file with dynamic values
44-
- command: subprocess.exec
45-
params:
46-
include_expansions_in_env: ["is_patch", "project", "version_id"]
47-
binary: bash
48-
working_dir: "src"
49-
args:
50-
- .evergreen/scripts/setup-system.sh
51-
# Load the expansion file to make an evergreen variable with the current unique version
52-
- command: expansions.update
53-
params:
54-
file: src/expansion.yml
55-
56-
"upload test results":
57-
- command: attach.results
58-
params:
59-
file_location: "${DRIVERS_TOOLS}/results.json"
60-
- command: attach.xunit_results
61-
params:
62-
file: "src/xunit-results/TEST-*.xml"
63-
64-
"run server":
65-
- command: subprocess.exec
66-
params:
67-
binary: bash
68-
working_dir: "src"
69-
include_expansions_in_env: [VERSION, TOPOLOGY, AUTH, SSL, ORCHESTRATION_FILE, PYTHON_BINARY, PYTHON_VERSION,
70-
STORAGE_ENGINE, REQUIRE_API_VERSION, DRIVERS_TOOLS, TEST_CRYPT_SHARED, AUTH_AWS, LOAD_BALANCER, LOCAL_ATLAS]
71-
args: [.evergreen/just.sh, run-server, "${TEST_NAME}"]
72-
- command: expansions.update
73-
params:
74-
file: ${DRIVERS_TOOLS}/mo-expansion.yml
75-
76-
"run just script":
77-
- command: subprocess.exec
78-
type: test
79-
params:
80-
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
81-
binary: bash
82-
working_dir: "src"
83-
args: [.evergreen/just.sh, "${JUSTFILE_TARGET}"]
84-
85-
"run tests":
86-
- command: subprocess.exec
87-
type: test
88-
params:
89-
include_expansions_in_env: [AUTH, SSL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
90-
AWS_SESSION_TOKEN, COVERAGE, PYTHON_BINARY, LIBMONGOCRYPT_URL, MONGODB_URI, PYTHON_VERSION,
91-
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION, DEBUG_LOG,
92-
ORCHESTRATION_FILE, OCSP_SERVER_TYPE, VERSION]
93-
binary: bash
94-
working_dir: "src"
95-
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
96-
- command: subprocess.exec
97-
type: test
98-
params:
99-
working_dir: "src"
100-
binary: bash
101-
args: [.evergreen/just.sh, run-tests]
102-
103-
"cleanup":
104-
- command: subprocess.exec
105-
params:
106-
binary: bash
107-
working_dir: "src"
108-
args:
109-
- .evergreen/scripts/cleanup.sh
110-
111-
"teardown system":
112-
- command: subprocess.exec
113-
params:
114-
binary: bash
115-
working_dir: "src"
116-
args: [.evergreen/just.sh, teardown-tests]
117-
- command: subprocess.exec
118-
params:
119-
binary: bash
120-
working_dir: "src"
121-
args:
122-
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh
123-
124-
"assume ec2 role":
125-
- command: ec2.assume_role
126-
params:
127-
role_arn: ${aws_test_secrets_role}
128-
duration_seconds: 3600
129-
130-
"attach benchmark test results":
131-
- command: attach.results
132-
params:
133-
file_location: src/report.json
134-
135-
"send dashboard data":
136-
- command: perf.send
137-
params:
138-
file: src/results.json
139-
14032
pre:
14133
- func: "fetch source"
14234
- func: "setup system"

.evergreen/generated_configs/functions.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
functions:
2+
# Assume ec2 role
3+
assume ec2 role:
4+
- command: ec2.assume_role
5+
params:
6+
role_arn: ${aws_test_secrets_role}
7+
duration_seconds: 3600
8+
9+
# Attach benchmark test results
10+
attach benchmark test results:
11+
- command: attach.results
12+
params:
13+
file_location: src/report.json
14+
15+
# Cleanup
16+
cleanup:
17+
- command: subprocess.exec
18+
params:
19+
args:
20+
- .evergreen/scripts/cleanup.sh
21+
222
# Download and merge coverage
323
download and merge coverage:
424
- command: ec2.assume_role
@@ -56,6 +76,115 @@ functions:
5676
optional: "true"
5777
type: setup
5878

79+
# Fetch source
80+
fetch source:
81+
- command: git.get_project
82+
params:
83+
directory: src
84+
85+
# Run just script
86+
run just script:
87+
- command: subprocess.exec
88+
params:
89+
args:
90+
- .evergreen/just.sh
91+
- ${JUSTFILE_TARGET}
92+
include_expansions_in_env:
93+
- AWS_ACCESS_KEY_ID
94+
- AWS_SECRET_ACCESS_KEY
95+
- AWS_SESSION_TOKEN
96+
97+
# Run server
98+
run server:
99+
- command: subprocess.exec
100+
params:
101+
args:
102+
- .evergreen/just.sh
103+
- run-server
104+
- ${TEST_NAME}
105+
include_expansions_in_env:
106+
- VERSION
107+
- TOPOLOGY
108+
- AUTH
109+
- SSL
110+
- ORCHESTRATION_FILE
111+
- PYTHON_BINARY
112+
- PYTHON_VERSION
113+
- STORAGE_ENGINE
114+
- REQUIRE_API_VERSION
115+
- DRIVERS_TOOLS
116+
- TEST_CRYPT_SHARED
117+
- AUTH_AWS
118+
- LOAD_BALANCER
119+
- LOCAL_ATLAS
120+
- command: expansions.update
121+
params:
122+
file: ${DRIVERS_TOOLS}/mo-expansion.yml
123+
124+
# Run tests
125+
run tests:
126+
- command: subprocess.exec
127+
params:
128+
args:
129+
- .evergreen/just.sh
130+
- setup-tests
131+
- ${TEST_NAME}
132+
- ${SUB_TEST_NAME}
133+
include_expansions_in_env:
134+
- AUTH
135+
- SSL
136+
- AWS_ACCESS_KEY_ID
137+
- AWS_SECRET_ACCESS_KEY
138+
- AWS_SESSION_TOKEN
139+
- COVERAGE
140+
- PYTHON_BINARY
141+
- LIBMONGOCRYPT_URL
142+
- MONGODB_URI
143+
- PYTHON_VERSION
144+
- DISABLE_TEST_COMMANDS
145+
- GREEN_FRAMEWORK
146+
- NO_EXT
147+
- COMPRESSORS
148+
- MONGODB_API_VERSION
149+
- DEBUG_LOG
150+
- ORCHESTRATION_FILE
151+
- OCSP_SERVER_TYPE
152+
- VERSION
153+
- command: subprocess.exec
154+
params:
155+
args:
156+
- .evergreen/just.sh
157+
- run-tests
158+
159+
# Setup system
160+
setup system:
161+
- command: subprocess.exec
162+
params:
163+
binary: bash
164+
args:
165+
- .evergreen/scripts/setup-system.sh
166+
working_dir: src
167+
include_expansions_in_env:
168+
- is_patch
169+
- project
170+
- version_id
171+
type: test
172+
- command: expansions.update
173+
params:
174+
file: src/expansion.yml
175+
176+
# Teardown system
177+
teardown system:
178+
- command: subprocess.exec
179+
params:
180+
args:
181+
- .evergreen/just.sh
182+
- teardown-tests
183+
- command: subprocess.exec
184+
params:
185+
args:
186+
- ${DRIVERS_TOOLS}/.evergreen/teardown.sh
187+
59188
# Upload coverage
60189
upload coverage:
61190
- command: ec2.assume_role
@@ -115,3 +244,12 @@ functions:
115244
display_name: drivers-tools-logs.tar.gz
116245
optional: "true"
117246
type: setup
247+
248+
# Upload test results
249+
upload test results:
250+
- command: attach.results
251+
params:
252+
file_location: ${DRIVERS_TOOLS}/results.json
253+
- command: attach.xunit_results
254+
params:
255+
file: src/xunit-results/TEST-*.xml

.evergreen/scripts/generate_config.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
EvgCommandType,
1414
FunctionCall,
1515
archive_targz_pack,
16+
attach_results,
17+
attach_xunit_results,
1618
ec2_assume_role,
19+
expansions_update,
20+
git_get_project,
1721
s3_put,
1822
subprocess_exec,
1923
)
@@ -1291,6 +1295,112 @@ def create_upload_mo_artifacts_func():
12911295
return "upload mo artifacts", cmds
12921296

12931297

1298+
def create_fetch_source_func():
1299+
# Executes clone and applies the submitted patch, if any.
1300+
cmd = git_get_project(directory="src")
1301+
return "fetch source", [cmd]
1302+
1303+
1304+
def create_setup_system_func():
1305+
# Make an evergreen expansion file with dynamic values.
1306+
includes = ["is_patch", "project", "version_id"]
1307+
args = [".evergreen/scripts/setup-system.sh"]
1308+
setup_cmd = get_subprocess_exec(include_expansions_in_env=includes, args=args)
1309+
# Load the expansion file to make an evergreen variable with the current unique version.
1310+
expansion_cmd = expansions_update(file="src/expansion.yml")
1311+
return "setup system", [setup_cmd, expansion_cmd]
1312+
1313+
1314+
def create_upload_test_results_func():
1315+
results_cmd = attach_results(file_location="${DRIVERS_TOOLS}/results.json")
1316+
xresults_cmd = attach_xunit_results(file="src/xunit-results/TEST-*.xml")
1317+
return "upload test results", [results_cmd, xresults_cmd]
1318+
1319+
1320+
def create_run_server_func():
1321+
includes = [
1322+
"VERSION",
1323+
"TOPOLOGY",
1324+
"AUTH",
1325+
"SSL",
1326+
"ORCHESTRATION_FILE",
1327+
"PYTHON_BINARY",
1328+
"PYTHON_VERSION",
1329+
"STORAGE_ENGINE",
1330+
"REQUIRE_API_VERSION",
1331+
"DRIVERS_TOOLS",
1332+
"TEST_CRYPT_SHARED",
1333+
"AUTH_AWS",
1334+
"LOAD_BALANCER",
1335+
"LOCAL_ATLAS",
1336+
]
1337+
args = [".evergreen/just.sh", "run-server", "${TEST_NAME}"]
1338+
sub_cmd = subprocess_exec(include_expansions_in_env=includes, args=args)
1339+
expansion_cmd = expansions_update(file="${DRIVERS_TOOLS}/mo-expansion.yml")
1340+
return "run server", [sub_cmd, expansion_cmd]
1341+
1342+
1343+
def create_run_just_script_func():
1344+
includes = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
1345+
args = [".evergreen/just.sh", "${JUSTFILE_TARGET}"]
1346+
cmd = subprocess_exec(include_expansions_in_env=includes, args=args)
1347+
return "run just script", [cmd]
1348+
1349+
1350+
def create_run_tests_func():
1351+
includes = [
1352+
"AUTH",
1353+
"SSL",
1354+
"AWS_ACCESS_KEY_ID",
1355+
"AWS_SECRET_ACCESS_KEY",
1356+
"AWS_SESSION_TOKEN",
1357+
"COVERAGE",
1358+
"PYTHON_BINARY",
1359+
"LIBMONGOCRYPT_URL",
1360+
"MONGODB_URI",
1361+
"PYTHON_VERSION",
1362+
"DISABLE_TEST_COMMANDS",
1363+
"GREEN_FRAMEWORK",
1364+
"NO_EXT",
1365+
"COMPRESSORS",
1366+
"MONGODB_API_VERSION",
1367+
"DEBUG_LOG",
1368+
"ORCHESTRATION_FILE",
1369+
"OCSP_SERVER_TYPE",
1370+
"VERSION",
1371+
]
1372+
args = [".evergreen/just.sh", "setup-tests", "${TEST_NAME}", "${SUB_TEST_NAME}"]
1373+
setup_cmd = subprocess_exec(include_expansions_in_env=includes, args=args)
1374+
test_cmd = subprocess_exec(args=[".evergreen/just.sh", "run-tests"])
1375+
return "run tests", [setup_cmd, test_cmd]
1376+
1377+
1378+
def create_cleanup_func():
1379+
cmd = subprocess_exec(args=[".evergreen/scripts/cleanup.sh"])
1380+
return "cleanup", [cmd]
1381+
1382+
1383+
def create_teardown_system_func():
1384+
tests_cmd = subprocess_exec(args=[".evergreen/just.sh", "teardown-tests"])
1385+
drivers_cmd = subprocess_exec(args=["${DRIVERS_TOOLS}/.evergreen/teardown.sh"])
1386+
return "teardown system", [tests_cmd, drivers_cmd]
1387+
1388+
1389+
def create_assume_ec2_role_func():
1390+
cmd = ec2_assume_role(role_arn="${aws_test_secrets_role}", duration_seconds=3600)
1391+
return "assume ec2 role", [cmd]
1392+
1393+
1394+
def create_attach_benchmark_test_results_func():
1395+
cmd = attach_results(file_location="src/report.json")
1396+
return "attach benchmark test results", [cmd]
1397+
1398+
1399+
# def create_send_dashboard_data_func():
1400+
# cmd = perf_send(file="src/results.json")
1401+
# return "send dashboard data", [cmd]
1402+
1403+
12941404
##################
12951405
# Generate Config
12961406
##################

0 commit comments

Comments
 (0)