Skip to content

Loosen the gitlab_runner connection-failure exception assertion#24298

Draft
mwdd146980 wants to merge 1 commit into
mwdd146980/httpx-migration-basefrom
mwdd146980/w1c-gitlab_runner
Draft

Loosen the gitlab_runner connection-failure exception assertion#24298
mwdd146980 wants to merge 1 commit into
mwdd146980/httpx-migration-basefrom
mwdd146980/w1c-gitlab_runner

Conversation

@mwdd146980

@mwdd146980 mwdd146980 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Loosens test_connection_failure in gitlab_runner/tests/test_integration.py from asserting requests.exceptions.ConnectionError to a bare pytest.raises(Exception), and removes the now-unused requests import.

Motivation

Part of the httpx2 migration. test_connection_failure triggers a genuine connection error against a real closed socket, so the exception type raised is an implementation detail of which HTTP backend (requests today, httpx after the migration flip) is active. Pinning to the agnostic exception type isn't possible yet since nothing on this path normalizes exceptions before the httpx backend flip, and pinning to requests.exceptions.ConnectionError would go red once the backend flips for no production reason. The two service checks the failure actually produces (gitlab_runner.can_connect and gitlab_runner.prometheus_endpoint_up, both asserted CRITICAL) are the observable behavior and are unchanged.

No production code is touched; only the test file changes.

Verification

  • ddev test -fs gitlab_runner: ruff format and ruff check both pass, no lint warning from the removed import.
  • grep -rn requests gitlab_runner/tests/test_integration.py returns no hits.
  • ddev --no-interactive test gitlab_runner -- -k test_connection_failure could not complete locally: the dd_environment fixture's GitLab CE container (gitlab-ce:10.8.0-ce.0, an amd64-only 2018 image) did not finish booting within the fixture's retry budget under emulation on this Apple Silicon host, across two ~10-minute attempts. This is an environment limitation, not a code issue — the failure occurs in fixture setup, before the test body (and the changed assertion) ever executes. CI runs on x86 Linux and should not hit this. Requesting CI confirm test_connection_failure passes.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mwdd146980 mwdd146980 added the qa/skip-qa Automatically skip this PR for the next QA label Jul 2, 2026
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

PR | test / test-minimum-base-package (linux, ubuntu-22.04, gitlab_runner, Gitlab Runner (py3.13-10.8.0), py3... / minimum-base-package-Gitlab Runner (py3.13-10.8.0)-py3.13-10.8.0   View in Datadog   GitHub Actions

Validate repository | Run Validations / Validate   View in Datadog   GitHub Actions

PR | test / check   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 92.97% (+4.84%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 539c1e7 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Validation Report

Validation Description Status
dep Verify dependency pins are consistent and Agent-compatible

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (20)
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

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

Labels

integration/gitlab_runner qa/skip-qa Automatically skip this PR for the next QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant