Skip to content

fix(k8s): hermetic cluster secrets fixture resolution in test suite #6957

Done

Description

@dan-petty

Problem Description

In tests/k8s/test_cluster_secrets_file.py, test_resolve_fixture_secrets_file_variants tests _resolve_fixture_secrets_file() by asserting assert cs._resolve_fixture_secrets_file() == cs._FIXTURE_SECRETS_FILE. When devops_cli is installed as a package inside the Service image container (/app/.venv), cs._FIXTURE_SECRETS_FILE does not exist on disk, so _resolve_fixture_secrets_file() falls back to _FALLBACK_FIXTURE_SECRETS_FILE (tests/fixtures/cluster-secrets.toml). This causes test_resolve_fixture_secrets_file_variants to fail with AssertionError: assert PosixPath('tests/fixtures/cluster-secrets.toml') == PosixPath('/app/.venv/lib/python3.14/tests/fixtures/cluster-secrets.toml'), breaking Service Image Tests (shard 1 of 6) across all pull request checks.

Additionally, src/devops_cli/k8s/cluster_secrets.py uses legacy syntax except ConfigurationError, OSError: in load_cluster_secrets_table(), and restricts fallback fixture loading with if env_file is None and k8s_dir is None:, preventing fixture resolution when k8s_dir is passed without a local cluster-secrets file.

Expected vs Actual Behavior

Expected: test_resolve_fixture_secrets_file_variants isolates the primary path using monkeypatch to set an existing dummy fixture, verifying primary, fallback, and absent cases hermetically regardless of whether the test runs in an editable or installed environment. load_cluster_secrets_table() catches both (ConfigurationError, OSError) and falls back to the fixture whenever env_file is None.
Actual: test_resolve_fixture_secrets_file_variants fails in Service Image Tests, breaking CI.

Activity

  1. added
    type/bug
    scope/k8s
    priority/p1-high
    owner/agent
    on Nov 24, 2026
  2. added a commit that references this issue on Nov 24, 2026
    cb289f7
  3. added
    status/in-progress
    status/in-review
    and removed
    status/in-progress
    on Nov 24, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 24, 2026
  5. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-24 13:45 UTC

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

    priority/p1-highscope/k8stype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions