Skip to content

Commit 395320e

Browse files
committed
min deps tests
1 parent 2f7946f commit 395320e

File tree

10 files changed

+213
-100
lines changed

10 files changed

+213
-100
lines changed

.evergreen/generated_configs/tasks.yml

Lines changed: 183 additions & 44 deletions
Large diffs are not rendered by default.

.evergreen/generated_configs/variants.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ buildvariants:
177177
- name: encryption-rhel8
178178
tasks:
179179
- name: .test-non-standard
180-
- name: .test-min-deps
181180
display_name: Encryption RHEL8
182181
run_on:
183182
- rhel87-small
@@ -208,7 +207,6 @@ buildvariants:
208207
- name: encryption-crypt_shared-rhel8
209208
tasks:
210209
- name: .test-non-standard
211-
- name: .test-min-deps
212210
display_name: Encryption crypt_shared RHEL8
213211
run_on:
214212
- rhel87-small

.evergreen/scripts/generate_config.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def get_encryption_expansions(encryption):
128128
):
129129
expansions = get_encryption_expansions(encryption)
130130
display_name = get_variant_name(encryption, host, **expansions)
131-
tasks = [".test-non-standard", ".test-min-deps"]
131+
tasks = [".test-non-standard"]
132132
if host != "rhel8":
133133
tasks = [".test-non-standard !.pypy"]
134134
variant = create_variant(
@@ -575,6 +575,8 @@ def create_server_version_tasks():
575575
seen.add(combo)
576576
tags.append("pr")
577577
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology)
578+
if python == ALL_PYTHONS[0]:
579+
expansions["TEST_MIN_DEPS"] = "1"
578580
if "t" in python:
579581
tags.append("free-threaded")
580582
if python not in PYPYS and "t" not in python:
@@ -640,6 +642,8 @@ def create_test_non_standard_tasks():
640642
if pr:
641643
tags.append("pr")
642644
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology, VERSION=version)
645+
if python == ALL_PYTHONS[0]:
646+
expansions["TEST_MIN_DEPS"] = "1"
643647
name = get_task_name("test-non-standard", python=python, **expansions)
644648
server_func = FunctionCall(func="run server", vars=expansions)
645649
test_vars = expansions.copy()
@@ -680,6 +684,8 @@ def create_test_standard_auth_tasks():
680684
if pr:
681685
tags.append("pr")
682686
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology, VERSION=version)
687+
if python == ALL_PYTHONS[0]:
688+
expansions["TEST_MIN_DEPS"] = "1"
683689
name = get_task_name("test-standard-auth", python=python, **expansions)
684690
server_func = FunctionCall(func="run server", vars=expansions)
685691
test_vars = expansions.copy()
@@ -689,22 +695,6 @@ def create_test_standard_auth_tasks():
689695
return tasks
690696

691697

692-
def create_min_deps_tasks():
693-
"""For variants that support testing with minimum dependencies."""
694-
tasks = []
695-
for topology in TOPOLOGIES:
696-
auth, ssl = get_standard_auth_ssl(topology)
697-
tags = ["test-min-deps", f"{topology}-{auth}-{ssl}"]
698-
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology)
699-
server_func = FunctionCall(func="run server", vars=expansions)
700-
test_vars = expansions.copy()
701-
test_vars["TEST_MIN_DEPS"] = "1"
702-
name = get_task_name("test-min-deps", python=CPYTHONS[0], sync="sync", **test_vars)
703-
test_func = FunctionCall(func="run tests", vars=test_vars)
704-
tasks.append(EvgTask(name=name, tags=tags, commands=[server_func, test_func]))
705-
return tasks
706-
707-
708698
def create_standard_tasks():
709699
"""For variants that do not set a TEST_NAME."""
710700
tasks = []
@@ -732,6 +722,8 @@ def create_standard_tasks():
732722
if pr:
733723
tags.append("pr")
734724
expansions = dict(AUTH=auth, SSL=ssl, TOPOLOGY=topology, VERSION=version)
725+
if python == ALL_PYTHONS[0]:
726+
expansions["TEST_MIN_DEPS"] = "1"
735727
name = get_task_name("test-standard", python=python, sync=sync, **expansions)
736728
server_func = FunctionCall(func="run server", vars=expansions)
737729
test_vars = expansions.copy()
@@ -749,9 +741,11 @@ def create_no_orchestration_tasks():
749741
"test-no-orchestration",
750742
f"python-{python}",
751743
]
752-
name = get_task_name("test-no-orchestration", python=python)
753744
assume_func = FunctionCall(func="assume ec2 role")
754745
test_vars = dict(TOOLCHAIN_VERSION=python)
746+
if python == ALL_PYTHONS[0]:
747+
test_vars["TEST_MIN_DEPS"] = "1"
748+
name = get_task_name("test-no-orchestration", **test_vars)
755749
test_func = FunctionCall(func="run tests", vars=test_vars)
756750
commands = [assume_func, test_func]
757751
tasks.append(EvgTask(name=name, tags=tags, commands=commands))
@@ -799,8 +793,10 @@ def create_aws_tasks():
799793
tags = [*base_tags, f"auth-aws-{test_type}"]
800794
if "t" in python:
801795
tags.append("free-threaded")
802-
name = get_task_name(f"{base_name}-{test_type}", python=python)
803796
test_vars = dict(TEST_NAME="auth_aws", SUB_TEST_NAME=test_type, TOOLCHAIN_VERSION=python)
797+
if python == ALL_PYTHONS[0]:
798+
test_vars["TEST_MIN_DEPS"] = "1"
799+
name = get_task_name(f"{base_name}-{test_type}", **test_vars)
804800
test_func = FunctionCall(func="run tests", vars=test_vars)
805801
funcs = [server_func, assume_func, test_func]
806802
tasks.append(EvgTask(name=name, tags=tags, commands=funcs))
@@ -879,6 +875,8 @@ def _create_ocsp_tasks(algo, variant, server_type, base_task_name):
879875
TOOLCHAIN_VERSION=python,
880876
VERSION=version,
881877
)
878+
if python == ALL_PYTHONS[0]:
879+
vars["TEST_MIN_DEPS"] = "1"
882880
test_func = FunctionCall(func="run tests", vars=vars)
883881

884882
tags = ["ocsp", f"ocsp-{algo}", version]
@@ -887,11 +885,7 @@ def _create_ocsp_tasks(algo, variant, server_type, base_task_name):
887885
if algo == "valid-cert-server-staples" and version == "latest":
888886
tags.append("pr")
889887

890-
task_name = get_task_name(
891-
f"test-ocsp-{algo}-{base_task_name}",
892-
python=python,
893-
version=version,
894-
)
888+
task_name = get_task_name(f"test-ocsp-{algo}-{base_task_name}", **vars)
895889
tasks.append(EvgTask(name=task_name, tags=tags, commands=[test_func]))
896890

897891
return tasks

.evergreen/scripts/generate_config_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def get_common_name(base: str, sep: str, **kwargs) -> str:
171171
display_name = f"{display_name}{sep}{version}"
172172
for key, value in kwargs.items():
173173
name = value
174-
if key.lower() == "python":
174+
if key.lower() in ["python", "toolchain_version"]:
175175
if not value.startswith("pypy"):
176176
name = f"Python{value}"
177177
else:

pymongo/ocsp_support.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
from cryptography.x509 import ExtensionNotFound as _ExtensionNotFound
4646
from cryptography.x509 import TLSFeature as _TLSFeature
4747
from cryptography.x509 import TLSFeatureType as _TLSFeatureType
48-
from cryptography.x509 import load_pem_x509_certificate as _load_pem_x509_certificate
4948
from cryptography.x509.ocsp import OCSPCertStatus as _OCSPCertStatus
5049
from cryptography.x509.ocsp import OCSPRequestBuilder as _OCSPRequestBuilder
5150
from cryptography.x509.ocsp import OCSPResponseStatus as _OCSPResponseStatus
@@ -102,19 +101,6 @@
102101
)
103102

104103

105-
def _load_trusted_ca_certs(cafile: str) -> list[Certificate]:
106-
"""Parse the tlsCAFile into a list of certificates."""
107-
with open(cafile, "rb") as f:
108-
data = f.read()
109-
110-
# Load all the certs in the file.
111-
trusted_ca_certs = []
112-
backend = _default_backend()
113-
for cert_data in _re.findall(_CERT_REGEX, data):
114-
trusted_ca_certs.append(_load_pem_x509_certificate(cert_data, backend))
115-
return trusted_ca_certs
116-
117-
118104
def _get_issuer_cert(
119105
cert: Certificate, chain: Iterable[Certificate], trusted_ca_certs: Optional[list[Certificate]]
120106
) -> Optional[Certificate]:

pymongo/pyopenssl_context.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from pymongo.errors import ConfigurationError as _ConfigurationError
3636
from pymongo.errors import _CertificateError # type:ignore[attr-defined]
3737
from pymongo.ocsp_cache import _OCSPCache
38-
from pymongo.ocsp_support import _load_trusted_ca_certs, _ocsp_callback
38+
from pymongo.ocsp_support import _ocsp_callback
3939
from pymongo.socket_checker import SocketChecker as _SocketChecker
4040
from pymongo.socket_checker import _errno_from_exception
4141
from pymongo.write_concern import validate_boolean
@@ -322,10 +322,6 @@ def load_verify_locations(
322322
ssl.CERT_NONE.
323323
"""
324324
self._ctx.load_verify_locations(cafile, capath)
325-
# Manually load the CA certs when get_verified_chain is not available (pyopenssl<20).
326-
if not hasattr(_SSL.Connection, "get_verified_chain"):
327-
assert cafile is not None
328-
self._callback_data.trusted_ca_certs = _load_trusted_ca_certs(cafile)
329325

330326
def _load_certifi(self) -> None:
331327
"""Attempt to load CA certs from certifi."""

requirements/gssapi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pykerberos;os.name!='nt'
1+
pykerberos>=1.2.4;os.name!='nt'
22
winkerberos>=0.5.0;os.name=='nt'

requirements/ocsp.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# store and just use certifi on macOS.
77
# https://www.pyopenssl.org/en/stable/api/ssl.html#OpenSSL.SSL.Context.set_default_verify_paths
88
certifi>=2023.7.22;os.name=='nt' or sys_platform=='darwin'
9-
pyopenssl>=17.2.0
10-
requests<3.0.0
11-
cryptography>=2.5
9+
pyopenssl>=20.0.0
10+
requests>=2.23.0,<3.0
11+
cryptography>=35.0
1212
service_identity>=18.1.0

requirements/snappy.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-snappy
1+
python-snappy>=0.6.0

uv.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)