Skip to content

Commit 7897afb

Browse files
authored
Merge branch 'master' into PYTHON-5253
2 parents 380adbb + f29c7b1 commit 7897afb

Some content is hidden

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

61 files changed

+570
-199
lines changed

.evergreen/generated_configs/functions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ functions:
145145
- MONGODB_API_VERSION
146146
- REQUIRE_API_VERSION
147147
- DEBUG_LOG
148+
- DISABLE_FLAKY
148149
- ORCHESTRATION_FILE
149150
- OCSP_SERVER_TYPE
150151
- VERSION

.evergreen/generated_configs/tasks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ tasks:
128128
- mongo-python-driver
129129
- ${github_commit}
130130
working_dir: src
131+
include_expansions_in_env:
132+
- AWS_ACCESS_KEY_ID
133+
- AWS_SECRET_ACCESS_KEY
134+
- AWS_SESSION_TOKEN
131135
type: test
132136

133137
# Coverage report tests

.evergreen/generated_configs/variants.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ buildvariants:
7575
display_name: Atlas connect RHEL8
7676
run_on:
7777
- rhel87-small
78+
expansions:
79+
TEST_NAME: atlas_connect
7880
tags: [pr]
7981

8082
# Atlas data lake tests

.evergreen/scripts/generate_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def create_atlas_connect_variants():
425425
get_variant_name("Atlas connect", host),
426426
tags=["pr"],
427427
host=DEFAULT_HOST,
428+
expansions=dict(TEST_NAME="atlas_connect"),
428429
)
429430
]
430431

@@ -896,7 +897,8 @@ def create_backport_pr_tasks():
896897
"mongo-python-driver",
897898
"${github_commit}",
898899
]
899-
cmd = get_subprocess_exec(args=args)
900+
include_expansions = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]
901+
cmd = get_subprocess_exec(args=args, include_expansions_in_env=include_expansions)
900902
assume_func = FunctionCall(func="assume ec2 role")
901903
return [EvgTask(name=name, commands=[assume_func, cmd], allowed_requesters=["commit"])]
902904

@@ -1084,6 +1086,7 @@ def create_run_tests_func():
10841086
"MONGODB_API_VERSION",
10851087
"REQUIRE_API_VERSION",
10861088
"DEBUG_LOG",
1089+
"DISABLE_FLAKY",
10871090
"ORCHESTRATION_FILE",
10881091
"OCSP_SERVER_TYPE",
10891092
"VERSION",

.evergreen/scripts/setup-system.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,14 @@ if [ "$(uname -s)" = "Darwin" ]; then
3838
fi
3939
fi
4040

41+
if [ -w /etc/hosts ]; then
42+
SUDO=""
43+
else
44+
SUDO="sudo"
45+
fi
46+
47+
# Add 'server' and 'hostname_not_in_cert' as a hostnames
48+
echo "127.0.0.1 server" | $SUDO tee -a /etc/hosts
49+
echo "127.0.0.1 hostname_not_in_cert" | $SUDO tee -a /etc/hosts
50+
4151
echo "Setting up system... done."

.evergreen/scripts/setup_tests.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ def handle_test_env() -> None:
162162
write_env("PIP_PREFER_BINARY") # Prefer binary dists by default.
163163
write_env("UV_FROZEN") # Do not modify lock files.
164164

165-
# Skip CSOT tests on non-linux platforms.
166-
if PLATFORM != "linux":
167-
write_env("SKIP_CSOT_TESTS")
168-
169165
# Set an environment variable for the test name and sub test name.
170166
write_env(f"TEST_{test_name.upper()}")
171167
write_env("TEST_NAME", test_name)
@@ -421,7 +417,18 @@ def handle_test_env() -> None:
421417
run_command(f"bash {auth_aws_dir}/setup-secrets.sh")
422418

423419
if test_name == "atlas_connect":
424-
get_secrets("drivers/atlas_connect")
420+
secrets = get_secrets("drivers/atlas_connect")
421+
422+
# Write file with Atlas X509 client certificate:
423+
decoded = base64.b64decode(secrets["ATLAS_X509_DEV_CERT_BASE64"]).decode("utf8")
424+
cert_file = ROOT / ".evergreen/atlas_x509_dev_client_certificate.pem"
425+
with cert_file.open("w") as file:
426+
file.write(decoded)
427+
write_env(
428+
"ATLAS_X509_DEV_WITH_CERT",
429+
secrets["ATLAS_X509_DEV"] + "&tlsCertificateKeyFile=" + str(cert_file),
430+
)
431+
425432
# We do not want the default client_context to be initialized.
426433
write_env("DISABLE_CONTEXT")
427434

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @mongodb/dbx-python

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3
49+
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3
5050
with:
5151
languages: ${{ matrix.language }}
5252
build-mode: ${{ matrix.build-mode }}
@@ -63,6 +63,6 @@ jobs:
6363
pip install -e .
6464
6565
- name: Perform CodeQL Analysis
66-
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3
66+
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3
6767
with:
6868
category: "/language:${{matrix.language}}"

.github/workflows/test-python.yml

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install just
2626
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
2727
- name: Install uv
28-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
28+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
2929
with:
3030
enable-cache: true
3131
python-version: "3.9"
@@ -65,7 +65,7 @@ jobs:
6565
- name: Install just
6666
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
6767
- name: Install uv
68-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
68+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
6969
with:
7070
enable-cache: true
7171
python-version: ${{ matrix.python-version }}
@@ -88,7 +88,7 @@ jobs:
8888
- name: Install just
8989
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
9090
- name: Install uv
91-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
91+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
9292
with:
9393
enable-cache: true
9494
python-version: "3.9"
@@ -111,7 +111,7 @@ jobs:
111111
with:
112112
persist-credentials: false
113113
- name: Install uv
114-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
114+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
115115
with:
116116
enable-cache: true
117117
python-version: "3.9"
@@ -130,7 +130,7 @@ jobs:
130130
with:
131131
persist-credentials: false
132132
- name: Install uv
133-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
133+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
134134
with:
135135
enable-cache: true
136136
python-version: "3.9"
@@ -152,7 +152,7 @@ jobs:
152152
with:
153153
persist-credentials: false
154154
- name: Install uv
155-
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v5
155+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
156156
with:
157157
enable-cache: true
158158
python-version: "${{matrix.python}}"
@@ -220,3 +220,55 @@ jobs:
220220
which python
221221
pip install -e ".[test]"
222222
PYMONGO_MUST_CONNECT=1 pytest -v -k client_context
223+
224+
test_minimum:
225+
permissions:
226+
contents: read
227+
runs-on: ubuntu-latest
228+
name: Test using minimum dependencies and supported Python
229+
steps:
230+
- uses: actions/checkout@v4
231+
with:
232+
persist-credentials: false
233+
- name: Install uv
234+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
235+
with:
236+
python-version: '3.9'
237+
- name: Start MongoDB
238+
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
239+
with:
240+
mongodb-version: 6.0
241+
# Async and our test_dns do not support dnspython 1.X, so we don't run async or dns tests here
242+
- name: Run tests
243+
shell: bash
244+
run: |
245+
uv venv
246+
source .venv/bin/activate
247+
uv pip install -e ".[test]" --resolution=lowest-direct
248+
pytest -v test/test_srv_polling.py
249+
250+
test_minimum_for_async:
251+
permissions:
252+
contents: read
253+
runs-on: ubuntu-latest
254+
name: Test async's minimum dependencies and Python
255+
steps:
256+
- uses: actions/checkout@v4
257+
with:
258+
persist-credentials: false
259+
- name: Install uv
260+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v5
261+
with:
262+
python-version: '3.9'
263+
- name: Start MongoDB
264+
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
265+
with:
266+
mongodb-version: 6.0
267+
# The lifetime kwarg we use in srv resolution was added to the async resolver API in dnspython 2.1.0
268+
- name: Run tests
269+
shell: bash
270+
run: |
271+
uv venv
272+
source .venv/bin/activate
273+
uv pip install -e ".[test]" --resolution=lowest-direct dnspython==2.1.0 --force-reinstall
274+
pytest -v test/test_srv_polling.py test/test_dns.py test/asynchronous/test_srv_polling.py test/asynchronous/test_dns.py

.github/workflows/zizmor.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,5 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
persist-credentials: false
20-
- name: Setup Rust
21-
uses: actions-rust-lang/setup-rust-toolchain@9d7e65c320fdb52dcd45ffaa68deb6c02c8754d9 # v1
22-
- name: Get zizmor
23-
run: cargo install zizmor
2420
- name: Run zizmor 🌈
25-
run: zizmor --format sarif . > results.sarif
26-
env:
27-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
- name: Upload SARIF file
29-
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3
30-
with:
31-
sarif_file: results.sarif
32-
category: zizmor
21+
uses: zizmorcore/zizmor-action@0f0557ab4a0b31211d42435e42df31cbd63fdd59

0 commit comments

Comments
 (0)