Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8118aea
PYTHON-4844 - Skip async test_encryption.AsyncTestSpec.test_legacy_ti…
NoahStapp Oct 11, 2024
3a66229
PYTHON-4700 - Convert CSFLE tests to async (#1907)
NoahStapp Oct 11, 2024
6973d2d
PYTHON-4528 - Convert unified test runner to async (#1913)
NoahStapp Oct 11, 2024
7e86d24
PYTHON-4849 - Convert test.test_connection_logging.py to async (#1918)
NoahStapp Oct 11, 2024
e0fde23
PYTHON-4850 - Convert test.test_crud_unified to async (#1920)
NoahStapp Oct 11, 2024
b2332b2
PYTHON-4846 - Convert test.test_command_logging.py to async (#1915)
NoahStapp Oct 11, 2024
4eeaa4b
PYTHON-4848 - Convert test.test_command_monitoring.py to async (#1917)
NoahStapp Oct 11, 2024
33163ec
PYTHON-4804 Migrate test_comment.py to async (#1887)
sleepyStick Oct 11, 2024
3c5e71a
PYTHON-4862 Fix handling of interrupt_loop in unified test runner (#1…
blink1073 Oct 14, 2024
9ba780c
PYTHON-4861 Ensure hatch is isolated in Evergreen (#1923)
blink1073 Oct 14, 2024
3cc722e
PYTHON-4838 Generate OCSP build variants using shrub.py (#1910)
blink1073 Oct 14, 2024
a911245
PYTHON-4866 Fix test_command_cursor_to_list_csot_applied (#1926)
ShaneHarvey Oct 14, 2024
9e38c54
PYTHON-4861 Fix HATCH_CONFIG on cygwin (#1927)
ShaneHarvey Oct 14, 2024
872fda1
PYTHON-4574 - FaaS detection logic mistakenly identifies EKS as AWS L…
NoahStapp Oct 15, 2024
710bc40
PYTHON-4870 - MongoClient.address should block until a connection suc…
NoahStapp Oct 15, 2024
82e673d
PYTHON-4870 - Update changelog for MongoClient.address fix (#1931)
NoahStapp Oct 15, 2024
1b6c0d3
PYTHON-4868 Generate server tests using shrub.py (#1930)
blink1073 Oct 15, 2024
3855eff
PYTHON-4842 - Convert test.test_create_entities to async (#1919)
NoahStapp Oct 15, 2024
fa263dc
PYTHON-4847 - Convert test.test_collection_management.py to async (#1…
NoahStapp Oct 15, 2024
8034bae
PYTHON-4834 Add __repr__ to IndexModel, SearchIndexModel (#1909)
aclark4life Oct 15, 2024
463518b
PYTHON-4765 Resync server-selection spec (#1935)
aclark4life Oct 16, 2024
d1375d4
PYTHON-4865 Skip test_write_concern_failure tests temporarily (#1936)
blink1073 Oct 16, 2024
29064f5
PYTHON-4873 Remove bson-stdint-win32.h from THIRD-PARTY-NOTICES (#1937)
ShaneHarvey Oct 16, 2024
6f4258c
PYTHON-4576 Allow update to supply sort option (#1881)
blink1073 Oct 16, 2024
8ce21bc
PYTHON-4872 Use shrub.py to generate encryption tasks (#1938)
blink1073 Oct 17, 2024
a62ade8
PYTHON-4874 - Add KMS support for async Windows (#1939)
NoahStapp Oct 17, 2024
79033bc
Revert "PYTHON-4765 Resync server-selection spec" (#1940)
blink1073 Oct 17, 2024
257aa24
PYTHON-4878 Use shrub.py for load balancer tests (#1941)
blink1073 Oct 17, 2024
317a539
PYTHON-4879 Use shrub.py for compressor tests (#1944)
blink1073 Oct 17, 2024
7e904b3
PYTHON-4874 Fix async Windows KMS support (#1942)
ShaneHarvey Oct 17, 2024
335b728
Bump pyright from 1.1.383 to 1.1.384 (#1922)
dependabot[bot] Oct 18, 2024
021a9f7
PYTHON-4882 Use shrub.py for enterprise auth tests (#1945)
blink1073 Oct 18, 2024
6a7e83d
PYTHON-4887 Do not test macos arm64 on server versions < 6.0 (#1947)
blink1073 Oct 18, 2024
1ae0c39
PYTHON-4886 Use shrub.py for PyOpenSSL tests (#1946)
blink1073 Oct 18, 2024
a1ade45
PYTHON-4881 - Use OvertCommandListener wherever sensitive events are …
NoahStapp Oct 18, 2024
24f3f36
Merge branch 'master' into async-improvements
NoahStapp Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,539 changes: 1,237 additions & 302 deletions .evergreen/config.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .evergreen/hatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ else # Set up virtualenv before installing hatch
fi
export HATCH_CONFIG
hatch config restore
hatch config set dirs.data ".hatch/data"
hatch config set dirs.cache ".hatch/cache"
hatch config set dirs.data "$(pwd)/.hatch/data"
hatch config set dirs.cache "$(pwd)/.hatch/cache"

run_hatch() {
python -m hatch run "$@"
Expand Down
4 changes: 3 additions & 1 deletion .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -o xtrace

AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
TEST_SUITES=""
TEST_SUITES=${TEST_SUITES:-}
TEST_ARGS="${*:1}"

export PIP_QUIET=1 # Quiet by default
Expand Down Expand Up @@ -90,6 +90,8 @@ if [ -n "$TEST_ENTERPRISE_AUTH" ]; then
export GSSAPI_HOST=${SASL_HOST}
export GSSAPI_PORT=${SASL_PORT}
export GSSAPI_PRINCIPAL=${PRINCIPAL}

export TEST_SUITES="auth"
fi

if [ -n "$TEST_LOADBALANCER" ]; then
Expand Down
310 changes: 297 additions & 13 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,23 @@
##############

ALL_VERSIONS = ["4.0", "4.4", "5.0", "6.0", "7.0", "8.0", "rapid", "latest"]
VERSIONS_6_0_PLUS = ["6.0", "7.0", "8.0", "rapid", "latest"]
CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
PYPYS = ["pypy3.9", "pypy3.10"]
ALL_PYTHONS = CPYTHONS + PYPYS
MIN_MAX_PYTHON = [CPYTHONS[0], CPYTHONS[-1]]
BATCHTIME_WEEK = 10080
AUTH_SSLS = [("auth", "ssl"), ("noauth", "ssl"), ("noauth", "nossl")]
TOPOLOGIES = ["standalone", "replica_set", "sharded_cluster"]
C_EXTS = ["with_ext", "without_ext"]
SYNCS = ["sync", "async"]
DISPLAY_LOOKUP = dict(
ssl=dict(ssl="SSL", nossl="NoSSL"),
auth=dict(auth="Auth", noauth="NoAuth"),
test_suites=dict(default="Sync", default_async="Async"),
coverage=dict(coverage="cov"),
no_ext={"1": "No C"},
)
HOSTS = dict()


Expand All @@ -39,7 +52,9 @@ class Host:

HOSTS["rhel8"] = Host("rhel8", "rhel87-small", "RHEL8")
HOSTS["win64"] = Host("win64", "windows-64-vsMulti-small", "Win64")
HOSTS["win32"] = Host("win32", "windows-64-vsMulti-small", "Win32")
HOSTS["macos"] = Host("macos", "macos-14", "macOS")
HOSTS["macos-arm64"] = Host("macos-arm64", "macos-14-arm64", "macOS Arm64")


##############
Expand Down Expand Up @@ -80,10 +95,8 @@ def create_variant(

def get_python_binary(python: str, host: str) -> str:
"""Get the appropriate python binary given a python version and host."""
if host == "win64":
is_32 = python.startswith("32-bit")
if is_32:
_, python = python.split()
if host in ["win64", "win32"]:
if host == "win32":
base = "C:/python/32"
else:
base = "C:/python"
Expand All @@ -93,19 +106,31 @@ def get_python_binary(python: str, host: str) -> str:
if host == "rhel8":
return f"/opt/python/{python}/bin/python3"

if host == "macos":
if host in ["macos", "macos-arm64"]:
return f"/Library/Frameworks/Python.Framework/Versions/{python}/bin/python3"

raise ValueError(f"no match found for python {python} on {host}")


def get_display_name(base: str, host: str, version: str, python: str) -> str:
def get_display_name(base: str, host: str, **kwargs) -> str:
"""Get the display name of a variant."""
if version not in ["rapid", "latest"]:
version = f"v{version}"
if not python.startswith("pypy"):
python = f"py{python}"
return f"{base} {HOSTS[host].display_name} {version} {python}"
display_name = f"{base} {HOSTS[host].display_name}"
version = kwargs.pop("VERSION", None)
if version:
if version not in ["rapid", "latest"]:
version = f"v{version}"
display_name = f"{display_name} {version}"
for key, value in kwargs.items():
name = value
if key.lower() == "python":
if not value.startswith("pypy"):
name = f"py{value}"
elif key.lower() in DISPLAY_LOOKUP:
name = DISPLAY_LOOKUP[key.lower()][value]
else:
continue
display_name = f"{display_name} {name}"
return display_name


def zip_cycle(*iterables, empty_default=None):
Expand All @@ -115,6 +140,21 @@ def zip_cycle(*iterables, empty_default=None):
yield tuple(next(i, empty_default) for i in cycles)


def handle_c_ext(c_ext, expansions):
"""Handle c extension option."""
if c_ext == C_EXTS[0]:
expansions["NO_EXT"] = "1"


def generate_yaml(tasks=None, variants=None):
"""Generate the yaml for a given set of tasks and variants."""
project = EvgProject(tasks=tasks, buildvariants=variants)
out = ShrubService.generate_yaml(project)
# Dedent by two spaces to match what we use in config.yml
lines = [line[2:] for line in out.splitlines()]
print("\n".join(lines)) # noqa: T201


##############
# Variants
##############
Expand Down Expand Up @@ -159,9 +199,253 @@ def create_ocsp_variants() -> list[BuildVariant]:
return variants


def create_server_variants() -> list[BuildVariant]:
variants = []

# Run the full matrix on linux with min and max CPython, and latest pypy.
host = "rhel8"
for python, (auth, ssl) in product([*MIN_MAX_PYTHON, PYPYS[-1]], AUTH_SSLS):
display_name = f"Test {host}"
expansions = dict(AUTH=auth, SSL=ssl, COVERAGE="coverage")
display_name = get_display_name("Test", host, python=python, **expansions)
variant = create_variant(
[f".{t}" for t in TOPOLOGIES],
display_name,
python=python,
host=host,
tags=["coverage_tag"],
expansions=expansions,
)
variants.append(variant)

# Test the rest of the pythons on linux.
for python, (auth, ssl), topology in zip_cycle(
CPYTHONS[1:-1] + PYPYS[:-1], AUTH_SSLS, TOPOLOGIES
):
display_name = f"Test {host}"
expansions = dict(AUTH=auth, SSL=ssl)
display_name = get_display_name("Test", host, python=python, **expansions)
variant = create_variant(
[f".{topology}"],
display_name,
python=python,
host=host,
expansions=expansions,
)
variants.append(variant)

# Test a subset on each of the other platforms.
for host in ("macos", "macos-arm64", "win64", "win32"):
for (python, (auth, ssl), topology), sync in product(
zip_cycle(MIN_MAX_PYTHON, AUTH_SSLS, TOPOLOGIES), SYNCS
):
test_suite = "default" if sync == "sync" else "default_async"
tasks = [f".{topology}"]
# MacOS arm64 only works on server versions 6.0+
if host == "macos-arm64":
tasks = [f".{topology} .{version}" for version in VERSIONS_6_0_PLUS]
expansions = dict(AUTH=auth, SSL=ssl, TEST_SUITES=test_suite, SKIP_CSOT_TESTS="true")
display_name = get_display_name("Test", host, python=python, **expansions)
variant = create_variant(
tasks,
display_name,
python=python,
host=host,
expansions=expansions,
)
variants.append(variant)

return variants


def create_encryption_variants() -> list[BuildVariant]:
variants = []
tags = ["encryption_tag"]
batchtime = BATCHTIME_WEEK

def get_encryption_expansions(encryption, ssl="ssl"):
expansions = dict(AUTH="auth", SSL=ssl, test_encryption="true")
if "crypt_shared" in encryption:
expansions["test_crypt_shared"] = "true"
if "PyOpenSSL" in encryption:
expansions["test_encryption_pyopenssl"] = "true"
return expansions

host = "rhel8"

# Test against all server versions and topolgies for the three main python versions.
encryptions = ["Encryption", "Encryption crypt_shared", "Encryption PyOpenSSL"]
for encryption, python in product(encryptions, [*MIN_MAX_PYTHON, PYPYS[-1]]):
expansions = get_encryption_expansions(encryption)
display_name = get_display_name(encryption, host, python=python, **expansions)
variant = create_variant(
[f".{t}" for t in TOPOLOGIES],
display_name,
python=python,
host=host,
expansions=expansions,
batchtime=batchtime,
tags=tags,
)
variants.append(variant)

# Test the rest of the pythons on linux for all server versions.
for encryption, python, ssl in zip_cycle(
encryptions, CPYTHONS[1:-1] + PYPYS[:-1], ["ssl", "nossl"]
):
expansions = get_encryption_expansions(encryption, ssl)
display_name = get_display_name(encryption, host, python=python, **expansions)
variant = create_variant(
[".replica_set"],
display_name,
python=python,
host=host,
expansions=expansions,
)
variants.append(variant)

# Test on macos and linux on one server version and topology for min and max python.
encryptions = ["Encryption", "Encryption crypt_shared"]
task_names = [".latest .replica_set"]
for host, encryption, python in product(["macos", "win64"], encryptions, MIN_MAX_PYTHON):
ssl = "ssl" if python == CPYTHONS[0] else "nossl"
expansions = get_encryption_expansions(encryption, ssl)
display_name = get_display_name(encryption, host, python=python, **expansions)
variant = create_variant(
task_names,
display_name,
python=python,
host=host,
expansions=expansions,
batchtime=batchtime,
tags=tags,
)
variants.append(variant)
return variants


def create_load_balancer_variants():
# Load balancer tests - run all supported versions for all combinations of auth and ssl and system python.
host = "rhel8"
task_names = ["load-balancer-test"]
batchtime = BATCHTIME_WEEK
expansions_base = dict(test_loadbalancer="true")
versions = ["6.0", "7.0", "8.0", "latest", "rapid"]
variants = []
pythons = CPYTHONS + PYPYS
for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)):
expansions = dict(VERSION=version, AUTH=auth, SSL=ssl)
expansions.update(expansions_base)
python = pythons[ind % len(pythons)]
display_name = get_display_name("Load Balancer", host, python=python, **expansions)
variant = create_variant(
task_names,
display_name,
python=python,
host=host,
expansions=expansions,
batchtime=batchtime,
)
variants.append(variant)
return variants


def create_compression_variants():
# Compression tests - standalone versions of each server, across python versions, with and without c extensions.
# PyPy interpreters are always tested without extensions.
host = "rhel8"
task_names = dict(snappy=[".standalone"], zlib=[".standalone"], zstd=[".standalone !.4.0"])
variants = []
for ind, (compressor, c_ext) in enumerate(product(["snappy", "zlib", "zstd"], C_EXTS)):
expansions = dict(COMPRESSORS=compressor)
handle_c_ext(c_ext, expansions)
base_name = f"{compressor} compression"
python = CPYTHONS[ind % len(CPYTHONS)]
display_name = get_display_name(base_name, host, python=python, **expansions)
variant = create_variant(
task_names[compressor],
display_name,
python=python,
host=host,
expansions=expansions,
)
variants.append(variant)

other_pythons = PYPYS + CPYTHONS[ind:]
for compressor, python in zip_cycle(["snappy", "zlib", "zstd"], other_pythons):
expansions = dict(COMPRESSORS=compressor)
handle_c_ext(c_ext, expansions)
base_name = f"{compressor} compression"
display_name = get_display_name(base_name, host, python=python, **expansions)
variant = create_variant(
task_names[compressor],
display_name,
python=python,
host=host,
expansions=expansions,
)
variants.append(variant)

return variants


def create_enterprise_auth_variants():
expansions = dict(AUTH="auth")
variants = []

# All python versions across platforms.
for python in ALL_PYTHONS:
if python == CPYTHONS[0]:
host = "macos"
elif python == CPYTHONS[-1]:
host = "win64"
else:
host = "rhel8"
display_name = get_display_name("Enterprise Auth", host, python=python, **expansions)
variant = create_variant(
["test-enterprise-auth"], display_name, host=host, python=python, expansions=expansions
)
variants.append(variant)

return variants


def create_pyopenssl_variants():
base_name = "PyOpenSSL"
batchtime = BATCHTIME_WEEK
base_expansions = dict(test_pyopenssl="true", SSL="ssl")
variants = []

for python in ALL_PYTHONS:
# Only test "noauth" with min python.
auth = "noauth" if python == CPYTHONS[0] else "auth"
if python == CPYTHONS[0]:
host = "macos"
elif python == CPYTHONS[-1]:
host = "win64"
else:
host = "rhel8"
expansions = dict(AUTH=auth)
expansions.update(base_expansions)

display_name = get_display_name(base_name, host, python=python)
variant = create_variant(
[".replica_set", ".7.0"],
display_name,
python=python,
host=host,
expansions=expansions,
batchtime=batchtime,
)
variants.append(variant)

return variants


##################
# Generate Config
##################

project = EvgProject(tasks=None, buildvariants=create_ocsp_variants())
print(ShrubService.generate_yaml(project)) # noqa: T201
variants = create_pyopenssl_variants()
# print(len(variants))
generate_yaml(variants=variants)
Loading
Loading