Skip to content

Commit 04fc9a5

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo-python-driver
2 parents fd4049b + 257aa24 commit 04fc9a5

File tree

7 files changed

+1166
-33
lines changed

7 files changed

+1166
-33
lines changed

.evergreen/config.yml

Lines changed: 197 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,16 +2354,6 @@ axes:
23542354
variables:
23552355
ORCHESTRATION_FILE: "versioned-api-testing.json"
23562356

2357-
# Run load balancer tests?
2358-
- id: loadbalancer
2359-
display_name: "Load Balancer"
2360-
values:
2361-
- id: "enabled"
2362-
display_name: "Load Balancer"
2363-
variables:
2364-
test_loadbalancer: true
2365-
batchtime: 10080 # 7 days
2366-
23672357
- id: serverless
23682358
display_name: "Serverless"
23692359
values:
@@ -3580,6 +3570,203 @@ buildvariants:
35803570
VERSION: "8.0"
35813571
PYTHON_BINARY: /Library/Frameworks/Python.Framework/Versions/3.13/bin/python3
35823572

3573+
# Load balancer tests
3574+
- name: load-balancer-rhel8-v6.0-py3.9-auth-ssl
3575+
tasks:
3576+
- name: load-balancer-test
3577+
display_name: Load Balancer RHEL8 v6.0 py3.9 Auth SSL
3578+
run_on:
3579+
- rhel87-small
3580+
batchtime: 10080
3581+
expansions:
3582+
VERSION: "6.0"
3583+
AUTH: auth
3584+
SSL: ssl
3585+
test_loadbalancer: "true"
3586+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3587+
- name: load-balancer-rhel8-v6.0-py3.10-noauth-ssl
3588+
tasks:
3589+
- name: load-balancer-test
3590+
display_name: Load Balancer RHEL8 v6.0 py3.10 NoAuth SSL
3591+
run_on:
3592+
- rhel87-small
3593+
batchtime: 10080
3594+
expansions:
3595+
VERSION: "6.0"
3596+
AUTH: noauth
3597+
SSL: ssl
3598+
test_loadbalancer: "true"
3599+
PYTHON_BINARY: /opt/python/3.10/bin/python3
3600+
- name: load-balancer-rhel8-v6.0-py3.11-noauth-nossl
3601+
tasks:
3602+
- name: load-balancer-test
3603+
display_name: Load Balancer RHEL8 v6.0 py3.11 NoAuth NoSSL
3604+
run_on:
3605+
- rhel87-small
3606+
batchtime: 10080
3607+
expansions:
3608+
VERSION: "6.0"
3609+
AUTH: noauth
3610+
SSL: nossl
3611+
test_loadbalancer: "true"
3612+
PYTHON_BINARY: /opt/python/3.11/bin/python3
3613+
- name: load-balancer-rhel8-v7.0-py3.12-auth-ssl
3614+
tasks:
3615+
- name: load-balancer-test
3616+
display_name: Load Balancer RHEL8 v7.0 py3.12 Auth SSL
3617+
run_on:
3618+
- rhel87-small
3619+
batchtime: 10080
3620+
expansions:
3621+
VERSION: "7.0"
3622+
AUTH: auth
3623+
SSL: ssl
3624+
test_loadbalancer: "true"
3625+
PYTHON_BINARY: /opt/python/3.12/bin/python3
3626+
- name: load-balancer-rhel8-v7.0-py3.13-noauth-ssl
3627+
tasks:
3628+
- name: load-balancer-test
3629+
display_name: Load Balancer RHEL8 v7.0 py3.13 NoAuth SSL
3630+
run_on:
3631+
- rhel87-small
3632+
batchtime: 10080
3633+
expansions:
3634+
VERSION: "7.0"
3635+
AUTH: noauth
3636+
SSL: ssl
3637+
test_loadbalancer: "true"
3638+
PYTHON_BINARY: /opt/python/3.13/bin/python3
3639+
- name: load-balancer-rhel8-v7.0-pypy3.9-noauth-nossl
3640+
tasks:
3641+
- name: load-balancer-test
3642+
display_name: Load Balancer RHEL8 v7.0 pypy3.9 NoAuth NoSSL
3643+
run_on:
3644+
- rhel87-small
3645+
batchtime: 10080
3646+
expansions:
3647+
VERSION: "7.0"
3648+
AUTH: noauth
3649+
SSL: nossl
3650+
test_loadbalancer: "true"
3651+
PYTHON_BINARY: /opt/python/pypy3.9/bin/python3
3652+
- name: load-balancer-rhel8-v8.0-pypy3.10-auth-ssl
3653+
tasks:
3654+
- name: load-balancer-test
3655+
display_name: Load Balancer RHEL8 v8.0 pypy3.10 Auth SSL
3656+
run_on:
3657+
- rhel87-small
3658+
batchtime: 10080
3659+
expansions:
3660+
VERSION: "8.0"
3661+
AUTH: auth
3662+
SSL: ssl
3663+
test_loadbalancer: "true"
3664+
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
3665+
- name: load-balancer-rhel8-v8.0-py3.9-noauth-ssl
3666+
tasks:
3667+
- name: load-balancer-test
3668+
display_name: Load Balancer RHEL8 v8.0 py3.9 NoAuth SSL
3669+
run_on:
3670+
- rhel87-small
3671+
batchtime: 10080
3672+
expansions:
3673+
VERSION: "8.0"
3674+
AUTH: noauth
3675+
SSL: ssl
3676+
test_loadbalancer: "true"
3677+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3678+
- name: load-balancer-rhel8-v8.0-py3.10-noauth-nossl
3679+
tasks:
3680+
- name: load-balancer-test
3681+
display_name: Load Balancer RHEL8 v8.0 py3.10 NoAuth NoSSL
3682+
run_on:
3683+
- rhel87-small
3684+
batchtime: 10080
3685+
expansions:
3686+
VERSION: "8.0"
3687+
AUTH: noauth
3688+
SSL: nossl
3689+
test_loadbalancer: "true"
3690+
PYTHON_BINARY: /opt/python/3.10/bin/python3
3691+
- name: load-balancer-rhel8-latest-py3.11-auth-ssl
3692+
tasks:
3693+
- name: load-balancer-test
3694+
display_name: Load Balancer RHEL8 latest py3.11 Auth SSL
3695+
run_on:
3696+
- rhel87-small
3697+
batchtime: 10080
3698+
expansions:
3699+
VERSION: latest
3700+
AUTH: auth
3701+
SSL: ssl
3702+
test_loadbalancer: "true"
3703+
PYTHON_BINARY: /opt/python/3.11/bin/python3
3704+
- name: load-balancer-rhel8-latest-py3.12-noauth-ssl
3705+
tasks:
3706+
- name: load-balancer-test
3707+
display_name: Load Balancer RHEL8 latest py3.12 NoAuth SSL
3708+
run_on:
3709+
- rhel87-small
3710+
batchtime: 10080
3711+
expansions:
3712+
VERSION: latest
3713+
AUTH: noauth
3714+
SSL: ssl
3715+
test_loadbalancer: "true"
3716+
PYTHON_BINARY: /opt/python/3.12/bin/python3
3717+
- name: load-balancer-rhel8-latest-py3.13-noauth-nossl
3718+
tasks:
3719+
- name: load-balancer-test
3720+
display_name: Load Balancer RHEL8 latest py3.13 NoAuth NoSSL
3721+
run_on:
3722+
- rhel87-small
3723+
batchtime: 10080
3724+
expansions:
3725+
VERSION: latest
3726+
AUTH: noauth
3727+
SSL: nossl
3728+
test_loadbalancer: "true"
3729+
PYTHON_BINARY: /opt/python/3.13/bin/python3
3730+
- name: load-balancer-rhel8-rapid-pypy3.9-auth-ssl
3731+
tasks:
3732+
- name: load-balancer-test
3733+
display_name: Load Balancer RHEL8 rapid pypy3.9 Auth SSL
3734+
run_on:
3735+
- rhel87-small
3736+
batchtime: 10080
3737+
expansions:
3738+
VERSION: rapid
3739+
AUTH: auth
3740+
SSL: ssl
3741+
test_loadbalancer: "true"
3742+
PYTHON_BINARY: /opt/python/pypy3.9/bin/python3
3743+
- name: load-balancer-rhel8-rapid-pypy3.10-noauth-ssl
3744+
tasks:
3745+
- name: load-balancer-test
3746+
display_name: Load Balancer RHEL8 rapid pypy3.10 NoAuth SSL
3747+
run_on:
3748+
- rhel87-small
3749+
batchtime: 10080
3750+
expansions:
3751+
VERSION: rapid
3752+
AUTH: noauth
3753+
SSL: ssl
3754+
test_loadbalancer: "true"
3755+
PYTHON_BINARY: /opt/python/pypy3.10/bin/python3
3756+
- name: load-balancer-rhel8-rapid-py3.9-noauth-nossl
3757+
tasks:
3758+
- name: load-balancer-test
3759+
display_name: Load Balancer RHEL8 rapid py3.9 NoAuth NoSSL
3760+
run_on:
3761+
- rhel87-small
3762+
batchtime: 10080
3763+
expansions:
3764+
VERSION: rapid
3765+
AUTH: noauth
3766+
SSL: nossl
3767+
test_loadbalancer: "true"
3768+
PYTHON_BINARY: /opt/python/3.9/bin/python3
3769+
35833770
- matrix_name: "oidc-auth-test"
35843771
matrix_spec:
35853772
platform: [ rhel8, macos, windows ]
@@ -3643,17 +3830,6 @@ buildvariants:
36433830
- name: "aws-auth-test-rapid"
36443831
- name: "aws-auth-test-latest"
36453832

3646-
- matrix_name: "load-balancer"
3647-
matrix_spec:
3648-
platform: rhel8
3649-
mongodb-version: ["6.0", "7.0", "8.0", "rapid", "latest"]
3650-
auth-ssl: "*"
3651-
python-version: "*"
3652-
loadbalancer: "*"
3653-
display_name: "Load Balancer ${platform} ${python-version} ${mongodb-version} ${auth-ssl}"
3654-
tasks:
3655-
- name: "load-balancer-test"
3656-
36573833
- name: testgcpkms-variant
36583834
display_name: "GCP KMS"
36593835
run_on:

.evergreen/scripts/generate_config.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ def get_python_binary(python: str, host: str) -> str:
112112
def get_display_name(base: str, host: str, **kwargs) -> str:
113113
"""Get the display name of a variant."""
114114
display_name = f"{base} {HOSTS[host].display_name}"
115+
version = kwargs.pop("VERSION", None)
116+
if version:
117+
if version not in ["rapid", "latest"]:
118+
version = f"v{version}"
119+
display_name = f"{display_name} {version}"
115120
for key, value in kwargs.items():
116121
name = value
117-
if key == "version":
118-
if value not in ["rapid", "latest"]:
119-
name = f"v{value}"
120-
elif key == "python":
122+
if key.lower() == "python":
121123
if not value.startswith("pypy"):
122124
name = f"py{value}"
123125
elif key.lower() in DISPLAY_LOOKUP:
@@ -309,8 +311,34 @@ def get_encryption_expansions(encryption, ssl="ssl"):
309311
return variants
310312

311313

314+
def create_load_balancer_variants():
315+
# Load balancer tests - run all supported versions for all combinations of auth and ssl and system python.
316+
host = "rhel8"
317+
task_names = ["load-balancer-test"]
318+
batchtime = BATCHTIME_WEEK
319+
expansions_base = dict(test_loadbalancer="true")
320+
versions = ["6.0", "7.0", "8.0", "latest", "rapid"]
321+
variants = []
322+
pythons = CPYTHONS + PYPYS
323+
for ind, (version, (auth, ssl)) in enumerate(product(versions, AUTH_SSLS)):
324+
expansions = dict(VERSION=version, AUTH=auth, SSL=ssl)
325+
expansions.update(expansions_base)
326+
python = pythons[ind % len(pythons)]
327+
display_name = get_display_name("Load Balancer", host, python=python, **expansions)
328+
variant = create_variant(
329+
task_names,
330+
display_name,
331+
python=python,
332+
host=host,
333+
expansions=expansions,
334+
batchtime=batchtime,
335+
)
336+
variants.append(variant)
337+
return variants
338+
339+
312340
##################
313341
# Generate Config
314342
##################
315343

316-
generate_yaml(variants=create_encryption_variants())
344+
generate_yaml(variants=create_load_balancer_variants())

pymongo/network_layer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ async def _async_sendall_ssl(
205205
total_sent += sent
206206

207207
async def _async_receive_ssl(
208-
conn: _sslConn, length: int, dummy: AbstractEventLoop
208+
conn: _sslConn, length: int, dummy: AbstractEventLoop, once: Optional[bool] = False
209209
) -> memoryview:
210210
mv = memoryview(bytearray(length))
211211
total_read = 0
@@ -215,6 +215,9 @@ async def _async_receive_ssl(
215215
while total_read < length:
216216
try:
217217
read = conn.recv_into(mv[total_read:])
218+
# KMS responses update their expected size after the first batch, stop reading after one loop
219+
if once:
220+
return mv[:read]
218221
if read == 0:
219222
raise OSError("connection closed")
220223
except BLOCKING_IO_ERRORS:

test/server_selection_logging/operation-id.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
}
198198
},
199199
{
200-
"level": "info",
200+
"level": "debug",
201201
"component": "serverSelection",
202202
"data": {
203203
"message": "Waiting for suitable server to become available",
@@ -383,7 +383,7 @@
383383
}
384384
},
385385
{
386-
"level": "info",
386+
"level": "debug",
387387
"component": "serverSelection",
388388
"data": {
389389
"message": "Waiting for suitable server to become available",

test/server_selection_logging/replica-set.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
}
185185
},
186186
{
187-
"level": "info",
187+
"level": "debug",
188188
"component": "serverSelection",
189189
"data": {
190190
"message": "Waiting for suitable server to become available",

test/server_selection_logging/sharded.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
}
194194
},
195195
{
196-
"level": "info",
196+
"level": "debug",
197197
"component": "serverSelection",
198198
"data": {
199199
"message": "Waiting for suitable server to become available",

0 commit comments

Comments
 (0)