Skip to content

Count only the matching warning in the plugin sync 403 test - #574

Merged
simonhamp merged 1 commit into
mainfrom
fix/plugin-sync-warning-assertion
Oct 23, 2026
Merged

simonhamp merged 1 commit into
mainfrom
fix/plugin-sync-warning-assertion

Conversation

@simonhamp

Copy link
Copy Markdown
Member

test_sync_does_not_read_default_branch_when_release_discovery_fails has failed on main since #553, so every PR's Tests check is red (#573 included).

On a 403 the service logs two warnings: Failed to fetch latest tag for ... from the catch in the tag lookup, then [PluginSync] Could not discover latest release from sync(). The test called ->once() before ->with(...). Mockery checks the count as soon as once() runs, before the argument matcher is attached, so it counted both warnings and failed with "called 2 times".

The fix moves once() after with(), so the test still checks that the "Could not discover latest release" warning is logged exactly once. No app code changes.

Testing: the test fails on main and passes with this change. All 13 tests in PluginSyncServiceTest pass. Changing it to twice() makes it fail again, so the count is still being checked. Pint passes. I didn't run the full suite locally; CI will.

🤖 Generated with Claude Code

On a 403 the service logs two warnings: one from the tag lookup's catch
and one from sync(). The test called once() before with(), and Mockery
checks the count as soon as once() runs, so it counted both warnings and
failed. Putting with() first makes once() apply to the
"Could not discover latest release" warning only.

Main has failed this test since #553.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonhamp
simonhamp merged commit 47c9092 into main Oct 23, 2026
3 checks passed
@simonhamp
simonhamp deleted the fix/plugin-sync-warning-assertion branch October 23, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant