Skip to content

Commit 021a9f7

Browse files
authored
PYTHON-4882 Use shrub.py for enterprise auth tests (mongodb#1945)
1 parent 335b728 commit 021a9f7

File tree

6 files changed

+98
-19
lines changed

6 files changed

+98
-19
lines changed

.evergreen/config.yml

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,6 +3194,71 @@ buildvariants:
31943194
COMPRESSORS: zstd
31953195
PYTHON_BINARY: /opt/python/pypy3.9/bin/python3
31963196

3197+
# Enterprise auth tests.
3198+
- name: enterprise-auth-macos-py3.9-auth
3199+
tasks:
3200+
- name: test-enterprise-auth
3201+
display_name: Enterprise Auth macOS py3.9 Auth
3202+
run_on:
3203+
- macos-14
3204+
expansions:
3205+
AUTH: auth
3206+
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3
3207+
- name: enterprise-auth-rhel8-py3.10-auth
3208+
tasks:
3209+
- name: test-enterprise-auth
3210+
display_name: Enterprise Auth RHEL8 py3.10 Auth
3211+
run_on:
3212+
- rhel87-small
3213+
expansions:
3214+
AUTH: auth
3215+
PYTHON_BINARY: /opt/python/3.10/bin/python3
3216+
- name: enterprise-auth-rhel8-py3.11-auth
3217+
tasks:
3218+
- name: test-enterprise-auth
3219+
display_name: Enterprise Auth RHEL8 py3.11 Auth
3220+
run_on:
3221+
- rhel87-small
3222+
expansions:
3223+
AUTH: auth
3224+
PYTHON_BINARY: /opt/python/3.11/bin/python3
3225+
- name: enterprise-auth-rhel8-py3.12-auth
3226+
tasks:
3227+
- name: test-enterprise-auth
3228+
display_name: Enterprise Auth RHEL8 py3.12 Auth
3229+
run_on:
3230+
- rhel87-small
3231+
expansions:
3232+
AUTH: auth
3233+
PYTHON_BINARY: /opt/python/3.12/bin/python3
3234+
- name: enterprise-auth-win64-py3.13-auth
3235+
tasks:
3236+
- name: test-enterprise-auth
3237+
display_name: Enterprise Auth Win64 py3.13 Auth
3238+
run_on:
3239+
- windows-64-vsMulti-small
3240+
expansions:
3241+
AUTH: auth
3242+
PYTHON_BINARY: C:/python/Python313/python.exe
3243+
- name: enterprise-auth-rhel8-pypy3.9-auth
3244+
tasks:
3245+
- name: test-enterprise-auth
3246+
display_name: Enterprise Auth RHEL8 pypy3.9 Auth
3247+
run_on:
3248+
- rhel87-small
3249+
expansions:
3250+
AUTH: auth
3251+
PYTHON_BINARY: /opt/python/pypy3.9/bin/python3
3252+
- name: enterprise-auth-rhel8-pypy3.10-auth
3253+
tasks:
3254+
- name: test-enterprise-auth
3255+
display_name: Enterprise Auth RHEL8 pypy3.10 Auth
3256+
run_on:
3257+
- rhel87-small
3258+
expansions:
3259+
AUTH: auth
3260+
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
3261+
31973262
- matrix_name: "tests-fips"
31983263
matrix_spec:
31993264
platform:
@@ -3350,24 +3415,6 @@ buildvariants:
33503415
tasks:
33513416
- ".latest"
33523417

3353-
- matrix_name: "test-linux-enterprise-auth"
3354-
matrix_spec:
3355-
platform: rhel8
3356-
python-version: "*"
3357-
auth: "auth"
3358-
display_name: "Enterprise ${auth} ${platform} ${python-version}"
3359-
tasks:
3360-
- name: "test-enterprise-auth"
3361-
3362-
- matrix_name: "tests-windows-enterprise-auth"
3363-
matrix_spec:
3364-
platform: windows
3365-
python-version-windows: "*"
3366-
auth: "auth"
3367-
display_name: "Enterprise ${auth} ${platform} ${python-version-windows}"
3368-
tasks:
3369-
- name: "test-enterprise-auth"
3370-
33713418
- matrix_name: "test-search-index-helpers"
33723419
matrix_spec:
33733420
platform: rhel8

.evergreen/run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ if [ -n "$TEST_ENTERPRISE_AUTH" ]; then
9090
export GSSAPI_HOST=${SASL_HOST}
9191
export GSSAPI_PORT=${SASL_PORT}
9292
export GSSAPI_PRINCIPAL=${PRINCIPAL}
93+
94+
export TEST_SUITES="auth"
9395
fi
9496

9597
if [ -n "$TEST_LOADBALANCER" ]; then

.evergreen/scripts/generate_config.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,31 @@ def create_compression_variants():
384384
return variants
385385

386386

387+
def create_enterprise_auth_variants():
388+
expansions = dict(AUTH="auth")
389+
variants = []
390+
391+
# All python versions across platforms.
392+
for python in ALL_PYTHONS:
393+
if python == CPYTHONS[0]:
394+
host = "macos"
395+
elif python == CPYTHONS[-1]:
396+
host = "win64"
397+
else:
398+
host = "rhel8"
399+
display_name = get_display_name("Enterprise Auth", host, python=python, **expansions)
400+
variant = create_variant(
401+
["test-enterprise-auth"], display_name, host=host, python=python, expansions=expansions
402+
)
403+
variants.append(variant)
404+
405+
return variants
406+
407+
387408
##################
388409
# Generate Config
389410
##################
390411

391-
variants = create_compression_variants()
412+
variants = create_enterprise_auth_variants()
392413
# print(len(variants))
393414
generate_yaml(variants=variants)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ filterwarnings = [
9999
markers = [
100100
"auth_aws: tests that rely on pymongo-auth-aws",
101101
"auth_oidc: tests that rely on oidc auth",
102+
"auth: tests that rely on authentication",
102103
"ocsp: tests that rely on ocsp",
103104
"atlas: tests that rely on atlas",
104105
"data_lake: tests that rely on atlas data lake",

test/asynchronous/test_auth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
)
3333
from test.utils import AllowListEventListener, delay, ignore_deprecations
3434

35+
import pytest
36+
3537
from pymongo import AsyncMongoClient, monitoring
3638
from pymongo.asynchronous.auth import HAVE_KERBEROS
3739
from pymongo.auth_shared import _build_credentials_tuple
@@ -42,6 +44,8 @@
4244

4345
_IS_SYNC = False
4446

47+
pytestmark = pytest.mark.auth
48+
4549
# YOU MUST RUN KINIT BEFORE RUNNING GSSAPI TESTS ON UNIX.
4650
GSSAPI_HOST = os.environ.get("GSSAPI_HOST")
4751
GSSAPI_PORT = int(os.environ.get("GSSAPI_PORT", "27017"))

test/test_auth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
)
3333
from test.utils import AllowListEventListener, delay, ignore_deprecations
3434

35+
import pytest
36+
3537
from pymongo import MongoClient, monitoring
3638
from pymongo.auth_shared import _build_credentials_tuple
3739
from pymongo.errors import OperationFailure
@@ -42,6 +44,8 @@
4244

4345
_IS_SYNC = True
4446

47+
pytestmark = pytest.mark.auth
48+
4549
# YOU MUST RUN KINIT BEFORE RUNNING GSSAPI TESTS ON UNIX.
4650
GSSAPI_HOST = os.environ.get("GSSAPI_HOST")
4751
GSSAPI_PORT = int(os.environ.get("GSSAPI_PORT", "27017"))

0 commit comments

Comments
 (0)