Skip to content

Commit 08b2caf

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver into PYTHON-5213
2 parents 40211c7 + 1d866b3 commit 08b2caf

File tree

129 files changed

+297
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+297
-300
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,6 @@ functions:
284284
role_arn: ${aws_test_secrets_role}
285285
duration_seconds: 3600
286286

287-
"run perf tests":
288-
- command: subprocess.exec
289-
type: test
290-
params:
291-
working_dir: "src"
292-
binary: bash
293-
include_expansions_in_env: [SUB_TEST_NAME]
294-
args:
295-
- .evergreen/scripts/run-with-env.sh
296-
- .evergreen/scripts/run-perf-tests.sh
297-
298287
"attach benchmark test results":
299288
- command: attach.results
300289
params:
@@ -389,84 +378,6 @@ tasks:
389378
commands:
390379
- func: "download and merge coverage"
391380

392-
- name: "perf-6.0-standalone"
393-
tags: ["perf"]
394-
commands:
395-
- func: "run server"
396-
vars:
397-
VERSION: "v6.0-perf"
398-
- func: "run perf tests"
399-
vars:
400-
SUB_TEST_NAME: "sync"
401-
- func: "attach benchmark test results"
402-
- func: "send dashboard data"
403-
404-
- name: "perf-6.0-standalone-ssl"
405-
tags: ["perf"]
406-
commands:
407-
- func: "run server"
408-
vars:
409-
VERSION: "v6.0-perf"
410-
SSL: "ssl"
411-
- func: "run perf tests"
412-
vars:
413-
SUB_TEST_NAME: "sync"
414-
- func: "attach benchmark test results"
415-
- func: "send dashboard data"
416-
417-
- name: "perf-8.0-standalone"
418-
tags: ["perf"]
419-
commands:
420-
- func: "run server"
421-
vars:
422-
VERSION: "8.0"
423-
- func: "run perf tests"
424-
vars:
425-
SUB_TEST_NAME: "sync"
426-
- func: "attach benchmark test results"
427-
- func: "send dashboard data"
428-
429-
- name: "perf-6.0-standalone-async"
430-
tags: [ "perf" ]
431-
commands:
432-
- func: "run server"
433-
vars:
434-
VERSION: "v6.0-perf"
435-
TOPOLOGY: "server"
436-
- func: "run perf tests"
437-
vars:
438-
SUB_TEST_NAME: "async"
439-
- func: "attach benchmark test results"
440-
- func: "send dashboard data"
441-
442-
- name: "perf-6.0-standalone-ssl-async"
443-
tags: [ "perf" ]
444-
commands:
445-
- func: "run server"
446-
vars:
447-
VERSION: "v6.0-perf"
448-
TOPOLOGY: "server"
449-
SSL: "ssl"
450-
- func: "run perf tests"
451-
vars:
452-
SUB_TEST_NAME: "async"
453-
- func: "attach benchmark test results"
454-
- func: "send dashboard data"
455-
456-
- name: "perf-8.0-standalone-async"
457-
tags: [ "perf" ]
458-
commands:
459-
- func: "run server"
460-
vars:
461-
VERSION: "8.0"
462-
TOPOLOGY: "server"
463-
- func: "run perf tests"
464-
vars:
465-
SUB_TEST_NAME: "async"
466-
- func: "attach benchmark test results"
467-
- func: "send dashboard data"
468-
469-
470381
- name: "check-import-time"
471382
tags: ["pr"]
472383
commands:
@@ -532,15 +443,3 @@ buildvariants:
532443
- rhel8.7-small
533444
tasks:
534445
- name: "backport-pr"
535-
536-
- name: "perf-tests"
537-
display_name: "Performance Benchmarks"
538-
batchtime: 10080 # 7 days
539-
run_on: rhel90-dbx-perf-large
540-
tasks:
541-
- name: "perf-6.0-standalone"
542-
- name: "perf-6.0-standalone-ssl"
543-
- name: "perf-8.0-standalone"
544-
- name: "perf-6.0-standalone-async"
545-
- name: "perf-6.0-standalone-ssl-async"
546-
- name: "perf-8.0-standalone-async"

.evergreen/generated_configs/tasks.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,60 @@ tasks:
11601160
SUB_TEST_NAME: gke
11611161
tags: [auth_oidc, auth_oidc_remote]
11621162

1163+
# Perf tests
1164+
- name: perf-8.0-standalone-ssl
1165+
commands:
1166+
- func: run server
1167+
vars:
1168+
VERSION: v8.0-perf
1169+
SSL: ssl
1170+
- func: run tests
1171+
vars:
1172+
TEST_NAME: perf
1173+
SUB_TEST_NAME: sync
1174+
- func: attach benchmark test results
1175+
- func: send dashboard data
1176+
tags: [perf]
1177+
- name: perf-8.0-standalone-ssl-async
1178+
commands:
1179+
- func: run server
1180+
vars:
1181+
VERSION: v8.0-perf
1182+
SSL: ssl
1183+
- func: run tests
1184+
vars:
1185+
TEST_NAME: perf
1186+
SUB_TEST_NAME: async
1187+
- func: attach benchmark test results
1188+
- func: send dashboard data
1189+
tags: [perf]
1190+
- name: perf-8.0-standalone
1191+
commands:
1192+
- func: run server
1193+
vars:
1194+
VERSION: v8.0-perf
1195+
SSL: nossl
1196+
- func: run tests
1197+
vars:
1198+
TEST_NAME: perf
1199+
SUB_TEST_NAME: sync
1200+
- func: attach benchmark test results
1201+
- func: send dashboard data
1202+
tags: [perf]
1203+
- name: perf-8.0-standalone-async
1204+
commands:
1205+
- func: run server
1206+
vars:
1207+
VERSION: v8.0-perf
1208+
SSL: nossl
1209+
- func: run tests
1210+
vars:
1211+
TEST_NAME: perf
1212+
SUB_TEST_NAME: async
1213+
- func: attach benchmark test results
1214+
- func: send dashboard data
1215+
tags: [perf]
1216+
11631217
# Search index tests
11641218
- name: test-search-index-helpers
11651219
commands:

.evergreen/generated_configs/variants.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,15 @@ buildvariants:
936936
- windows-64-vsMulti-small
937937
batchtime: 10080
938938

939+
# Perf tests
940+
- name: performance-benchmarks
941+
tasks:
942+
- name: .perf
943+
display_name: Performance Benchmarks
944+
run_on:
945+
- rhel90-dbx-perf-large
946+
batchtime: 10080
947+
939948
# Pyopenssl tests
940949
- name: pyopenssl-macos-python3.9
941950
tasks:

.evergreen/run-perf-tests.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

.evergreen/run-tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ if [ -f "./secrets-export.sh" ]; then
3131
fi
3232

3333
# List the packages.
34-
PIP_QUIET=0 uv run ${UV_ARGS} --with pip pip list
34+
uv sync ${UV_ARGS} --reinstall
35+
uv pip list
3536

3637
# Start the test runner.
37-
uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@"
38+
uv run .evergreen/scripts/run_tests.py "$@"
3839

3940
popd

.evergreen/scripts/generate_config.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class Host:
6969
HOSTS["ubuntu20"] = Host("ubuntu20", "ubuntu2004-small", "Ubuntu-20", dict())
7070
HOSTS["ubuntu22"] = Host("ubuntu22", "ubuntu2204-small", "Ubuntu-22", dict())
7171
HOSTS["rhel7"] = Host("rhel7", "rhel79-small", "RHEL7", dict())
72+
HOSTS["perf"] = Host("perf", "rhel90-dbx-perf-large", "", dict())
7273
DEFAULT_HOST = HOSTS["rhel8"]
7374

7475
# Other hosts
@@ -722,6 +723,13 @@ def create_atlas_connect_variants():
722723
]
723724

724725

726+
def create_perf_variants():
727+
host = HOSTS["perf"]
728+
return [
729+
create_variant([".perf"], "Performance Benchmarks", host=host, batchtime=BATCHTIME_WEEK)
730+
]
731+
732+
725733
def create_aws_auth_variants():
726734
variants = []
727735

@@ -968,6 +976,26 @@ def create_enterprise_auth_tasks():
968976
return [EvgTask(name=task_name, tags=tags, commands=[server_func, assume_func, test_func])]
969977

970978

979+
def create_perf_tasks():
980+
tasks = []
981+
for version, ssl, sync in product(["8.0"], ["ssl", "nossl"], ["sync", "async"]):
982+
vars = dict(VERSION=f"v{version}-perf", SSL=ssl)
983+
server_func = FunctionCall(func="run server", vars=vars)
984+
vars = dict(TEST_NAME="perf", SUB_TEST_NAME=sync)
985+
test_func = FunctionCall(func="run tests", vars=vars)
986+
attach_func = FunctionCall(func="attach benchmark test results")
987+
send_func = FunctionCall(func="send dashboard data")
988+
task_name = f"perf-{version}-standalone"
989+
if ssl == "ssl":
990+
task_name += "-ssl"
991+
if sync == "async":
992+
task_name += "-async"
993+
tags = ["perf"]
994+
commands = [server_func, test_func, attach_func, send_func]
995+
tasks.append(EvgTask(name=task_name, tags=tags, commands=commands))
996+
return tasks
997+
998+
971999
def create_ocsp_tasks():
9721000
tasks = []
9731001
tests = [

.evergreen/scripts/run-perf-tests.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.evergreen/scripts/run_tests.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ def run() -> None:
185185
if TEST_PERF:
186186
handle_perf(start_time)
187187

188-
# Handle coverage post actions.
189-
if os.environ.get("COVERAGE"):
190-
shutil.rmtree(".pytest_cache", ignore_errors=True)
191-
192188

193189
if __name__ == "__main__":
194190
run()

.evergreen/scripts/setup_tests.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
# Map the test name to test group.
4444
GROUP_MAP = dict(mockupdb="mockupdb", perf="perf")
4545

46+
# The python version used for perf tests.
47+
PERF_PYTHON_VERSION = "3.9.13"
48+
4649

4750
def is_set(var: str) -> bool:
4851
value = os.environ.get(var, "")
@@ -384,6 +387,19 @@ def handle_test_env() -> None:
384387
write_env("DISABLE_CONTEXT")
385388

386389
if test_name == "perf":
390+
data_dir = ROOT / "specifications/source/benchmarking/data"
391+
if not data_dir.exists():
392+
run_command("git clone --depth 1 https://github.com/mongodb/specifications.git")
393+
run_command("tar xf extended_bson.tgz", cwd=data_dir)
394+
run_command("tar xf parallel.tgz", cwd=data_dir)
395+
run_command("tar xf single_and_multi_document.tgz", cwd=data_dir)
396+
write_env("TEST_PATH", str(data_dir))
397+
write_env("OUTPUT_FILE", str(ROOT / "results.json"))
398+
# Overwrite the UV_PYTHON from the env.sh file.
399+
write_env("UV_PYTHON", "")
400+
401+
UV_ARGS.append(f"--python={PERF_PYTHON_VERSION}")
402+
387403
# PYTHON-4769 Run perf_test.py directly otherwise pytest's test collection negatively
388404
# affects the benchmark results.
389405
if sub_test_name == "sync":

.evergreen/scripts/teardown_tests.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from __future__ import annotations
22

33
import os
4+
import shutil
45
import sys
6+
from pathlib import Path
57

6-
from utils import DRIVERS_TOOLS, LOGGER, run_command
8+
from utils import DRIVERS_TOOLS, LOGGER, ROOT, run_command
79

810
TEST_NAME = os.environ.get("TEST_NAME", "unconfigured")
911
SUB_TEST_NAME = os.environ.get("SUB_TEST_NAME")
@@ -48,10 +50,19 @@
4850
elif TEST_NAME == "auth_aws" and sys.platform != "darwin":
4951
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/auth_aws/teardown.sh")
5052

53+
# Tear down perf if applicable.
54+
elif TEST_NAME == "perf":
55+
shutil.rmtree(ROOT / "specifications", ignore_errors=True)
56+
Path(os.environ["OUTPUT_FILE"]).unlink(missing_ok=True)
57+
5158
# Tear down mog_wsgi if applicable.
5259
elif TEST_NAME == "mod_wsgi":
5360
from mod_wsgi_tester import teardown_mod_wsgi
5461

5562
teardown_mod_wsgi()
5663

64+
# Tear down coverage if applicable.
65+
if os.environ.get("COVERAGE"):
66+
shutil.rmtree(".pytest_cache", ignore_errors=True)
67+
5768
LOGGER.info(f"Tearing down tests of type '{TEST_NAME}'... done.")

0 commit comments

Comments
 (0)