Skip to content

[TEST] Flaky ADO auth unit tests in CI shard 2: ambient git credential helper leaks into test_auth.py #4762

Closed

Description

Flake (recurring, second day). Reported by the P3 Quality lane. Filed by Quality & Lifecycle.

Failing tests (CI unit shard 2; a rerun usually passes):

  • tests/unit/test_auth.py::TestBuildErrorContextADO (4 tests)
  • tests/unit/test_auth.py::TestCredentialFallbackOrderRegressionTrap::test_ado_attempts_bearer_before_raising

Symptom: git credential fill returned no credential (for dev.azure.com).

Seen on #4715, run 45039642745, job 137261093908. That PR touches no auth code.

Likely cause: test isolation. The tests do not pin the git credential environment, so an ambient credential helper or git config on the runner, or one leaked by another test in the same xdist worker, changes the credential-fill path.

Done when:

  • These tests pin their environment: an isolated HOME and GIT_CONFIG_GLOBAL/GIT_CONFIG_NOSYSTEM, no credential helper, and the subprocess mocked where intended.
  • They pass deterministically regardless of runner credential state.
  • A regression check proves the isolation: the test passes with a hostile credential helper configured in the environment.

Out of scope: auth behavior changes.

Activity

  1. danielmeppiel commented on Nov 22, 2026

    @danielmeppiel
    CollaboratorAuthor

    Decision: approve
    Area: project
    Scope: Tests only. tests/unit/test_auth.py (TestBuildErrorContextADO and TestCredentialFallbackOrderRegressionTrap::test_ado_attempts_bearer_before_raising) pin their git credential environment: an isolated HOME, GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM, no credential helper, and the git credential subprocess mocked where the test intends it, so an ambient helper or config on the runner, or state leaked by another test in the same worker, cannot change the credential-fill path. No auth behaviour changes.
    Done when: The tests pass deterministically; a regression check runs them with a hostile credential helper configured in the environment and they still pass; a local loop of 50 runs has no failure; CI is green. No CHANGELOG line (tests only).
    Out of scope: Auth behaviour or credential resolution order changes; other test modules.
    Review contact: Daniel Meppiel (@danielmeppiel)

  2. added
    status/accepted
    on Nov 22, 2026
  3. added
    area/testing
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testingstatus/acceptedtype/test

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions