Skip to content

PYTHON-6114 Run the mod_wsgi tests on GitHub Actions - #3069

Draft
blink1073 wants to merge 2 commits into
mongodb:mainfrom
blink1073:PYTHON-6114
Draft

blink1073 wants to merge 2 commits into
mongodb:mainfrom
blink1073:PYTHON-6114

Conversation

@blink1073

@blink1073 blink1073 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

PYTHON-6114

Replaces #3059, rebased on main including the merged subinterpreter support (#3061).

Changes in this PR

  • Reinstate the mod_wsgi infrastructure that was removed in PYTHON-6104 - remove mod wsgi from evergreen #3060.
  • Add the ability to run mod_wsgi locally on Linux and in a container otherwise.
  • Add GitHub Actions tests covering apache and httpd, min and max cpython, min and max server (6.0 is the lowest supported on the runner), and embedded and standalone modes.

Test Plan

  • just smoke-mod-wsgi passes both modes in an ubuntu:24.04 container; the tester cycle was also verified natively on Linux.
  • just lint-manual and the monitor, pooling, and uri_parser suites pass on Python 3.14 against MongoDB 8.0.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). (Upstream mod_wsgi issue for the child-exit crash pending; tracked in the PYTHON-6114 pitfalls.)

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

Comment thread .github/workflows/test-python.yml Fixed
Comment thread .github/workflows/test-python.yml Fixed
Comment thread .github/workflows/test-python.yml Fixed
Comment thread .github/workflows/test-python.yml Fixed
@semgrep-code-mongodb

Copy link
Copy Markdown

Semgrep found 2 github-actions-mutable-action-tag findings:

GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608.

🛟 Help? Slack #semgrep-help or go/semgrep-help.

Resolution Options:

  • Fix the code
  • Reply /fp $reason (if security gap doesn’t exist)
  • Reply /ar $reason (if gap is valid but intentional; add mitigations/monitoring)
  • Reply /other $reason (e.g., test-only)

Comment thread pymongo/auth_shared.py Fixed
@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
Comment thread .github/workflows/test-mod-wsgi.yml Fixed
@blink1073
blink1073 force-pushed the PYTHON-6114 branch 2 times, most recently from d2fdbd9 to 97bc775 Compare September 25, 2026 12:24
@blink1073
blink1073 marked this pull request as ready for review September 25, 2026 13:32
@blink1073
blink1073 requested a review from a team as a code owner September 25, 2026 13:32
@blink1073
blink1073 requested review from NoahStapp and a lite review from Copilot September 25, 2026 13:32
@blink1073 blink1073 changed the title PYTHON-6114 Move mod_wsgi tests from Evergreen to GitHub Actions Run the mod_wsgi tests on GitHub Actions Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved critical workflow and test-orchestration issues block reliable execution.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 5 High severity · 1 Medium severity · 2 Low severity

Open (8)
What changed in this PR

Moves mod_wsgi integration tests from Evergreen to GitHub Actions with shared local/CI tooling, dependency setup, and updated Apache configurations.

Changes:

  • Adds dedicated minimum- and latest-dependency workflows.
  • Adds mod_wsgi orchestration, version-matrix, and smoke-test tooling.
  • Updates documentation and removes obsolete Apache 2.2 configurations.
File Description
uv.lock Locks mod_wsgi and updated dependency metadata.
test/​mod_wsgi_test/​README.rst Documents CI and local testing.
test/​mod_wsgi_test/​httpd24fedora.conf Adds Fedora Apache configuration.
test/​mod_wsgi_test/​apache24ubuntu161404.conf Removes obsolete configuration.
test/​mod_wsgi_test/​apache24ubuntu.conf Adds Ubuntu Apache configuration.
test/​mod_wsgi_test/​apache22ubuntu1204.conf Removes obsolete configuration.
test/​mod_wsgi_test/​apache22amazon.conf Removes obsolete configuration.
pyproject.toml Adds the mod_wsgi dependency group.
justfile Adds smoke testing and dispatch integration.
CONTRIBUTING.md Documents running mod_wsgi tests.
.gitignore Ignores Apache logs.
.github/​workflows/​test-mod-wsgi.yml Defines GitHub Actions jobs.
.github/​actions/​mod-wsgi-versions/​action.yml Computes test versions.
.evergreen/​scripts/​mod_wsgi.sh Orchestrates native and container tests.
.evergreen/​scripts/​mod_wsgi_tester.py Manages Apache and test execution.
.evergreen/​scripts/​mod_wsgi_matrix.py Defines the version matrix.
.evergreen/​scripts/​dispatch.sh Dispatches shared test recipes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .evergreen/scripts/mod_wsgi.sh
Comment thread .evergreen/scripts/mod_wsgi.sh
Comment thread .evergreen/scripts/mod_wsgi.sh Outdated
Comment thread .github/workflows/test-mod-wsgi.yml
Comment thread test/mod_wsgi_test/httpd24fedora.conf Outdated
Comment thread .github/workflows/test-mod-wsgi.yml
Comment thread CONTRIBUTING.md Outdated
Comment thread test/mod_wsgi_test/README.rst Outdated
@blink1073
blink1073 marked this pull request as draft September 25, 2026 13:43
@blink1073 blink1073 closed this Sep 25, 2026
@blink1073 blink1073 reopened this Sep 25, 2026
@blink1073
blink1073 requested a balanced review from Copilot September 25, 2026 14:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .evergreen/scripts/mod_wsgi_tester.py Outdated
Comment thread .evergreen/scripts/mod_wsgi.sh Outdated
Comment thread .evergreen/scripts/mod_wsgi.sh Outdated
@blink1073
blink1073 force-pushed the PYTHON-6114 branch 2 times, most recently from b832734 to 3a6cf7e Compare September 25, 2026 15:49
@blink1073
blink1073 requested a balanced review from Copilot September 25, 2026 15:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .evergreen/scripts/mod_wsgi_tester.py Outdated
Comment thread .evergreen/scripts/mod_wsgi_tester.py Outdated
Comment thread test/mod_wsgi_test/README.rst Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Invalid local-action paths currently prevent both GitHub Actions jobs from running.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Run the workflow when bson changes

.github/​workflows/​test-mod-wsgi.yml:15

The WSGI application imports and extensively exercises bson, including asserting that its C extension is loaded, but a push changing only bson/** will skip this workflow. Add that path so these regressions are covered.

This issue also appears on line 29 of the same file.

Medium severity Install cleanup trap before setup

justfile:141

If setup fails, set -e exits immediately and never tears down the partially started Apache/container or clears the dispatch marker. Install an exit trap before setup so the smoke command cleans up on setup and test failures as well as on success.

@blink1073
blink1073 requested a balanced review from Copilot September 25, 2026 20:21
@blink1073 blink1073 changed the title Run the mod_wsgi tests on GitHub Actions PYTHON-6114 Run the mod_wsgi tests on GitHub Actions Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Both CI jobs use invalid local-action paths, preventing the workflow from starting successfully.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Remove unused urllib.error import causing Ruff F401 failure

.evergreen/​scripts/​mod_wsgi_tester.py:22

urllib.error is never referenced. Ruff selects the F rules and only exempts T201 for .evergreen/scripts/*.py (pyproject.toml:198-223,258-260), so this produces an F401 failure in the normal lint job.

Low severity Document required environment variables for manual Fedora setup

test/​mod_wsgi_test/​README.rst:61

The manual setup is incomplete for the newly added Fedora config: httpd24fedora.conf expands MOD_WSGI_PYTHON_HOME, while both top-level configs also expand PROJECT_DIRECTORY and MOD_WSGI_CONF. Following these instructions and starting the config directly therefore fails on undefined variables; document all required exports or direct this section to mod_wsgi_tester.py.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Both CI jobs reference the local composite action using an invalid path and will fail before running tests.

Review effort: Balanced
Findings: None

PYTHON-6104 removed the mod_wsgi tests from Evergreen. Restore the test
infrastructure they need: refresh the Apache configs (drop the stale
Apache 2.2 configs, add current apache24ubuntu and httpd24fedora
configs), update the README, and declare the mod_wsgi dependency group
the tests are installed from.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Invalid local-action paths prevent both new CI jobs from running, and the tester contains a lint failure.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)

Comment thread .evergreen/scripts/mod_wsgi.sh
Comment thread .evergreen/scripts/mod_wsgi_tester.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Failed setup can bypass mod_wsgi teardown and leave Apache or Docker resources running.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (1)

Comment thread .evergreen/scripts/mod_wsgi.sh

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Both new CI jobs use malformed local-action references, so neither reaches the mod_wsgi tests.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (2)

Comment thread CONTRIBUTING.md Outdated
Move the mod_wsgi tests to a dedicated test-mod-wsgi.yml workflow: a
min-deps job (Fedora container, httpd) and a latest job (Ubuntu,
apache2), each running standalone and embedded rounds, triggered when
mod_wsgi-relevant files change. The mod-wsgi-versions action computes
the CPython and MongoDB versions from the Evergreen config lists.

Add .evergreen/scripts/mod_wsgi.sh with dispatch.sh routing the just
recipes, so just setup-tests mod_wsgi <mode>, just run-tests, and just
teardown-tests run the tests against the host's Apache on Linux and
inside an ubuntu container with its own replica set otherwise (just
smoke-mod-wsgi runs both modes). mod_wsgi_tester.py drives Apache and
verifies readiness; mod_wsgi_matrix.py defines the version matrix.
Document the workflow and the local commands in CONTRIBUTING.md.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Both CI jobs use invalid repository-local action paths and therefore cannot start.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread .github/workflows/test-mod-wsgi.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Invalid local-action paths prevent both CI jobs from starting, and partial container initialization cannot recover automatically.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)

persist-credentials: false
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- id: versions
uses: $/.github/actions/mod-wsgi-versions
Comment on lines +131 to +136
if ! container_exists; then
docker run --name "$CONTAINER" -d ubuntu:24.04 sleep infinity
docker exec "$CONTAINER" apt-get update -qq
docker exec "$CONTAINER" apt-get install -y -qq apache2 apache2-dev build-essential curl jq git tar gzip ca-certificates
docker exec "$CONTAINER" useradd -m smoke
fi

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants