Skip to content

Flaky integration tests: PermissionError: Unauthorized #895

@PythonFZ

Description

@PythonFZ

Description

Two integration tests intermittently fail with PermissionError: Unauthorized in CI. They pass locally and on re-run — classic flaky behavior.

Affected tests

  • tests/zndraw/test_edit_lock_integration.py::test_lock_holder_can_modify (observed on Python 3.11)
  • tests/zndraw/worker/test_per_room.py::test_guest_can_register_room_job (observed on Python 3.13)

Error

Both fail with:

PermissionError: Unauthorized

Raised from the client's raise_for_status() method when the server returns 401.

Context

To investigate

  • Check if test_settings autouse fixture properly isolates env vars between tests
  • Check if Redis is fully flushed between server-based integration tests
  • Check JWT token expiry / clock skew under load
  • Try adding explicit server readiness checks beyond just /v1/health

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions