Skip to content

fix(tests): update stale test expectations after #924 watchdog, timeout, and /health behavior changes #936

Closed

Description

@vybe

Summary

Several integration and unit tests have expectations that no longer match current production behavior. All failures are test-side — the production code is correct. These need to be updated to restore clean CI signal.

Stale Tests

1. Watchdog two-cycle confirmation — tests/test_watchdog.py::TestTwoCycleOrphanConfirmation (3 failures)

PR #924 changed orphan recovery from single-cycle to two-cycle confirmation (watchdog:suspected_orphan:{eid} Redis sentinel). Tests were written before this change and assert report["orphans_suspected"] >= 1 after a single cycle — but suspected_count is now deferred to the second cycle.

Fix: Update test setup to run two watchdog cycles and assert on the second cycle's output, or add a dedicated first-cycle test that asserts orphans_suspected == 1 (deferred) and orphans_confirmed == 0.

2. Monitoring /health liveness overrides — tests/integration/test_monitoring_service.py::TestCheckNetworkHealthClassification (3 failures)

Tests named test_read_timeout_does_not_record, test_read_error_does_not_record, test_pool_timeout_does_not_record assert these exception types do NOT increment the failure counter. The code was intentionally changed: on a /health probe, ReadError and TimeoutException ARE liveness signals (agent event-loop wedged, OOM, etc.) and do record failures. The comment in monitoring_service.py explains the /health-specific override.

Fix: Rename tests to reflect current behavior and change assertions to assert failures_recorded == 1.

3. Execution timeout default — tests/test_agent_timeout.py::TestTimeoutGet::test_get_timeout_default_is_900 (1 failure)

Test expects default execution_timeout_seconds == 900. The column default was changed to 3600 (issue #665).

Fix: Update expected value to 3600.

4. files/mkdir uses wrong fixture — tests/test_agent_files.py::TestCreateFolder::test_create_folder_and_list (1 failure)

POST /api/agents/{name}/files/mkdir requires the agent container to be running; the endpoint returns 404 when the container does not exist. The test uses the created_agent fixture (agent record only, no running container) rather than a fixture that also starts the container.

Fix: Switch the TestCreateFolder tests that call the mkdir endpoint to use a fixture that ensures the agent container is running before the request is made.

5. Subscription auto-switch default — tests/test_subscription_auto_switch.py::TestAutoSwitchSetting::test_get_auto_switch_default_on (1 failure)

Test expects enabled == True but backend returns False. The feature default changed.

Fix: Update expected value to False (or verify and update if the default change was unintentional).

Acceptance Criteria

  • All 9 tests listed above pass in the full suite run
  • No production code changes — test files only
  • Each updated test accurately describes current intended behavior

Activity

  1. self-assigned this
    on May 25, 2026
  2. added a commit that references this issue on May 25, 2026
  3. added
    status-in-dev
    on May 25, 2026
  4. vybe commented on Jun 1, 2026

    @vybe
    ContributorAuthor

    Shipped in v0.6.0 (released via #998).

  5. added
    theme-infrastructure
    and removed
    status-in-dev
    on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p2theme-infrastructuretype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions