Skip to content

test(slm): four tests/api tests fail outside CI — pricing reads the deployed .env, admin-socket fails even alone #18234

Open

Description

@mrveiss

Problem

Two SLM backend test files fail on a developer host and pass in CI, so a local run of autobot-slm-backend/tests/api is never clean. Each local failure has to be re-triaged as "pre-existing", and that is how a real regression hides. Seen while verifying #18186 / #17455: tests/api gives 774 passed and these 4 failures, which are identical on the base tree.

Test Error (verbatim) Cause
tests/api/test_pricing_post_sync_16231.py::test_a_failing_pricing_refresh_records_the_reason_and_the_sync_still_succeeds no step names the pricing refresh failure: ["pricing refresh: failed to start: [Errno 13] Permission denied: '<deploy root>/autobot-backend/.env' …"] Not hermetic. api/_pricing_post_sync.py:97 reads the deployed .env under the real deploy root. On a host where that tree exists but is not readable by the test user, the refresh fails to start before the mocked failure is reached. CI has no deploy root, so the read is skipped.
…::test_a_timed_out_pricing_refresh_records_the_reason_and_the_sync_still_succeeds same, for the timeout case same
tests/api/test_local_admin_socket_15728.py::test_start_returns_a_handle_when_socket_activated AttributeError: module 'services' has no attribute 'local_admin_socket' Unknown. It fails even when the file runs alone. services is a conftest stub (MagicMock) in this suite. Why CI passes was not determined.
…::test_local_self_update_route_delegates_to_the_shared_trigger same unknown

Acceptance criteria

  • The pricing tests point the deployed dir at a tmp_path (or patch _load_env_file), so no test reads the real deploy root. They pass on a host where that tree exists and is unreadable.
  • The admin-socket tests' dependence on services.local_admin_socket is root-caused and stated here. They pass when run alone, in any order.
  • python3 -m pytest autobot-slm-backend/tests/api is clean on a developer host that has a deployed tree.

Activity

  1. mrveiss commented on Oct 12, 2026

    @mrveiss
    OwnerAuthor

    Another instance of this class, from merge train #6b (#18379). tests/api/test_ssh_restart_equivalence_18186.py built a SyncOrchestrator(), which creates CODE_CACHE_DIR, defaulting to /var/lib/slm/code-cache. On a deployed dev host that directory exists, so the tests pass there. On a CI runner they fail with FileNotFoundError. Fixed in the train by pointing CODE_CACHE_DIR at tmp_path.

    The class fix still belongs here: a test must not depend on a deployed host path existing, or not existing. A conftest guard could catch it by redirecting the known roots (/opt/autobot, /var/lib/slm, /etc/autobot) during tests.

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

    bugSomething isn't workingtesting

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions