Repository navigation
test(runtime): fix racy config-watcher reload assertions - #1074
Merged
Merged
Conversation
TestConfigWatcher_ReloadPropagatesGlobalConfigToUpstream failed CI (run 33043282299, job 98421741995) with "expected: 99999, actual: 20000". ReloadConfiguration publishes the configsvc snapshot first (configSvc.ReloadFromFile), then syncs the legacy r.cfg, then calls upstreamManager.SetGlobalConfig. Both tests gated on the snapshot with require.Eventually and then asserted a downstream surface once, so the snapshot wait could be satisfied while the upstream manager (or legacy r.cfg) still held the old value. Poll both downstream assertions on the same 5s/25ms cadence. TestConfigWatcher_ReloadSyncsLegacyGetConfig had the identical window and is fixed alongside it. Test-only change; no production behaviour altered. Verified: go test -race -count=20 -run TestConfigWatcher ./internal/runtime
Deploying mcpproxy-docs with
|
| Latest commit: |
0a97c77
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://762be6c2.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://claude-jolly-driscoll-14ce42.mcpproxy-docs.pages.dev |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 33097513662 --repo smart-mcp-proxy/mcpproxy-go
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestConfigWatcher_ReloadPropagatesGlobalConfigToUpstreamfailed the "End-to-End Tests (ubuntu-latest, 1.25)" job on 2026-08-27 (run 33043282299, job 98421741995) withexpected: 99999, actual: 20000(20000 = the initial fixture value).Root cause
Runtime.ReloadConfiguration(internal/runtime/lifecycle.go) commits the reload to three surfaces in sequence:configSvc.ReloadFromFile()— publishes the configsvc snapshotr.cfgsyncr.upstreamManager.SetGlobalConfig(...)Both affected tests gated on surface 1 with
require.Eventually, then asserted surface 2 or 3 exactly once. The snapshot wait can be satisfied while the later surfaces still hold the old value — a real window, not a fixture problem.TestConfigWatcher_ReloadSyncsLegacyGetConfighad the identical pattern againstrt.GetConfig()and would flake the same way; it is fixed alongside.Fix
Turn both downstream assertions into
require.Eventuallyon the same 5s/25ms cadence as the snapshot wait.The other tests in the file don't share the pattern — their post-wait assertions are negative checks after a fixed sleep, or reload counting.
Test-only change; no production behaviour altered.
Verification
Unrelated to the OAuth work in #1068/#1069 — it only surfaced in their CI run.
🤖 Generated with Claude Code