Skip to content

test(runtime): fix racy config-watcher reload assertions - #1074

Merged
Dumbris merged 1 commit into
mainfrom
claude/jolly-driscoll-14ce42
Aug 28, 2026
Merged

Dumbris merged 1 commit into
mainfrom
claude/jolly-driscoll-14ce42

Conversation

@Dumbris

@Dumbris Dumbris commented Aug 27, 2026

Copy link
Copy Markdown
Member

Problem

TestConfigWatcher_ReloadPropagatesGlobalConfigToUpstream failed the "End-to-End Tests (ubuntu-latest, 1.25)" job on 2026-08-27 (run 33043282299, job 98421741995) with expected: 99999, actual: 20000 (20000 = the initial fixture value).

Root cause

Runtime.ReloadConfiguration (internal/runtime/lifecycle.go) commits the reload to three surfaces in sequence:

  1. configSvc.ReloadFromFile() — publishes the configsvc snapshot
  2. legacy r.cfg sync
  3. r.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_ReloadSyncsLegacyGetConfig had the identical pattern against rt.GetConfig() and would flake the same way; it is fixed alongside.

Fix

Turn both downstream assertions into require.Eventually on 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

go test -race -count=20 -run TestConfigWatcher ./internal/runtime
ok  github.com/smart-mcp-proxy/mcpproxy-go/internal/runtime  396.148s

Unrelated to the OAuth work in #1068/#1069 — it only surfaced in their CI run.

🤖 Generated with Claude Code

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
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

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

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: claude/jolly-driscoll-14ce42

Available Artifacts

  • archive-darwin-amd64 (29 MB)
  • archive-darwin-arm64 (26 MB)
  • archive-linux-amd64 (17 MB)
  • archive-linux-arm64 (15 MB)
  • archive-windows-amd64 (29 MB)
  • archive-windows-arm64 (26 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (23 MB)
  • installer-dmg-darwin-arm64 (21 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 33097513662 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris
Dumbris merged commit 0ace8e1 into main Aug 28, 2026
36 checks passed
@Dumbris
Dumbris deleted the claude/jolly-driscoll-14ce42 branch August 28, 2026 04:03
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.

2 participants