← Back to issue list

Snap store endpoints test is flaky

View original Github issue

Metadata

Project
craft-store
Number
#243
Type
issue
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Flaky unit test test_snap_store: token expiry timestamp can be off by one second under load, causing intermittent CI failures. Unlabeled, unassigned, no maintainer response since filing ~20 months ago; only a Jira-sync bot comment.

Suggested action: needs triage

Reason: The issue has no labels, no assignee, and the only comment is the autogenerated Jira-sync bot message (CRAFT-3800), so it shows no sign of maintainer triage despite being 628 days old. The bug itself is real and well-documented (CI failure link, exact 1-second expiry mismatch), and the fix is straightforward (freeze/mock time in the test), so it should be triaged and kept open rather than closed as stale without evidence the test was fixed.

Impact: 25 Quick Win: 21.25 Staleness: 75 Complexity: 15 Confidence: 65 Support Request: 0

Issue body

### Bug Description `tests/unit/test_endpoints.py::test_snap_store` is flaky, as the expiry time can be off by a second due to the way it is generated. ### To Reproduce Put your machine under load, then run: `uv run pytest tests/unit/test_endpoints.py::test_snap_store` until you get it. Or see: https://github.com/canonical/craft-store/actions/runs/12286865000/job/34287817294?pr=241 ### part yaml ```shell n/a ``` ### Relevant log output ```shell ================================== FAILURES =================================== _______________________________ test_snap_store _______________________________ expires = <function expires.<locals>.offset_iso_dt at 0x000002D4A62ED800> def test_snap_store(expires): snap_store = endpoints.SNAP_STORE assert snap_store.tokens == "/api/v2/tokens" assert snap_store.tokens_exchange == "/api/v2/tokens/exchange" assert snap_store.whoami == "/api/v2/tokens/whoami" assert snap_store.upload == "/unscanned-upload/" > assert snap_store.get_token_request( permissions=["permission-foo", "permission-bar"], description="client description", ttl=1000, ) == { "permissions": ["permission-foo", "permission-bar"], "description": "client description", "expires": expires(1000), } E AssertionError: assert {'description...mission-bar']} == {'description...mission-bar']} E E Omitting 2 identical items, use -vv to show E Differing items: E {'expires': '2024-12-12T00:00:23+00:00'} != {'expires': '2024-12-12T00:00:22+00:00'} E E Full diff: E { E 'description': 'client description', E - 'expires': '2024-12-12T00:00:22+00:00', E ? ^ E + 'expires': '2024-12-12T00:00:23+00:00', E ? ^ E 'permissions': [ E 'permission-foo', E 'permission-bar', E ], E } tests\unit\test_endpoints.py:119: AssertionError =========================== short test summary info =========================== FAILED tests/unit/test_endpoints.py::test_snap_store - AssertionError: assert {'description...mission-bar']} == {'description...mission-bar']} Omitting 2 identical items, use -vv to show Differing items: {'expires': '2024-12-12T00:00:23+00:00'} != {'expires': '2024-12-12T00:00:22+00:00'} Full diff: { 'description': 'client description', - 'expires': '2024-12-12T00:00:22+00:00', ? ^ + 'expires': '2024-12-12T00:00:23+00:00', ? ^ 'permissions': [ 'permission-foo', 'permission-bar', ], } ================ 1 failed, 200 passed, 14 deselected in 4.78s ================= ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 21.25
Staleness: 75
Complexity: 15
Confidence: 65
Support Request: 0
needs triage Flaky unit test test_snap_store: token expiry timestamp can be off by one second under load, causing intermittent CI failures. Unlabeled, unassigned, no maintainer response since filing ~20 months ago; only a Jira-sync bot comment.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 5
needs triage Flaky unit test for snap store endpoints where the generated token expiry timestamp differs by one second. Unassigned, unlabelled, and inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 25
Confidence: 85
Support Request: 5
close stale Flaky unit test test_snap_store fails due to a 1-second discrepancy in the generated token expiry timestamp. Open for over 1.5 years with no maintainer response or fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 20
Confidence: 75
Support Request: 0
close stale Flaky test test_snap_store fails when load causes the generated expiry timestamp to drift by one second. Exact timestamp assertions trigger intermittent failures. Open and inactive for over a year, awaiting triage and a robust comparison fix.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.