Skip to content

test: skip fsync in internal/runtime and internal/storage tests (Windows PR Build timeout) - #1613

Merged
Dumbris merged 1 commit into
mainfrom
fix/runtime-tests-windows-fsync
Oct 13, 2026
Merged

Dumbris merged 1 commit into
mainfrom
fix/runtime-tests-windows-fsync

Conversation

@Dumbris

@Dumbris Dumbris commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Problem

internal/runtime took ~472s in the PR Build Build Binaries (windows-latest, windows, amd64, …) job, whose go test runs with the default 10m timeout. It timed out once on #1608 and passed on rerun.

Timings from run 38347737392 (Windows job 115142245158):

Test Windows
TestConfigCommit_CommitPathsConverge 92.0s
TestReviewPayload_MasksSecretsInsideShellCommandArgs 11.6s
TestUnquarantineViaConfigReload_LeavesIndexAlone 8.2s
… 78 more tests ≥1s 277.7s total for tests ≥1s

The package is I/O-bound rather than CPU-bound: on macOS it ran 263s at 18% CPU. Nearly every test builds a Runtime, and each one writes the config file (temp file + fsync + rename), commits to config.db (bbolt fsync per commit) and creates a Bleve index (scorch root.bolt). FlushFileBuffers is very expensive on the Windows runner. TestConfigCommit_CommitPathsConverge runs 200 rounds of five fsynced commit paths.

Fix

  • config.DisableWriteSyncForTesting() makes atomicWriteFileMode skip the fsync before the rename.
  • storage.DisableSyncForTesting() makes NewBoltDB open with bbolt NoSync.
  • A TestMain in internal/runtime calls both and also sets bbolt.DefaultOptions.NoSync, which Bleve's scorch copies for root.bolt. A second TestMain in internal/storage (~147s on Windows) calls DisableSyncForTesting.

Production code paths are unchanged: both switches default off, and only _test.go files call them. No test is skipped, shortened or retimed, and no timeout is raised. Writes are still visible in-process to every reader; only crash durability is dropped, and no test in these packages simulates a crash.

Local results (macOS)

Before After
internal/runtime (no race) 263s, 18% CPU 121s
TestConfigCommit_CommitPathsConverge 16.3s 0.5s
go test -race runtime/storage/config — all pass (runtime 259s)

Windows results (PR Build, windows-latest amd64)

Before (run 38347737392) After (run 38359460609)
Job duration 13m45s 7m04s
internal/runtime 471.7s 166.5s
internal/storage 147.4s 9.6s
TestConfigCommit_CommitPathsConverge 92.0s 1.0s

No test failures in the job.

🤖 Generated with Claude Code

internal/runtime took ~472s on the windows-latest PR Build job against go
test's 10m default timeout and timed out once on #1608. The package is
I/O-bound, not CPU-bound (18% CPU on macOS): nearly every test builds a
Runtime, which writes the config file (atomic write + fsync), commits to
config.db and creates a Bleve index, and FlushFileBuffers is expensive on
the Windows runner. TestConfigCommit_CommitPathsConverge alone spent 92s
there on 200 rounds of fsynced commits.

Add test-only switches, config.DisableWriteSyncForTesting and
storage.DisableSyncForTesting (bbolt NoSync), and call them from a TestMain
in internal/runtime (which also sets bbolt.DefaultOptions.NoSync for
Bleve's root.bolt) and internal/storage. Production writes are unchanged.
No test is skipped or shortened; in-process visibility of writes is the
same, only crash durability is dropped, which no test exercises.

Locally on macOS: internal/runtime 263s -> ~120s,
TestConfigCommit_CommitPathsConverge 16.3s -> 0.5s.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2b79f46
Status: ✅  Deploy successful!
Preview URL: https://124be0a3.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-runtime-tests-windows-fs.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

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/config/loader.go 25.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/runtime-tests-windows-fsync

Available Artifacts

  • archive-darwin-amd64 (31 MB)
  • archive-darwin-arm64 (28 MB)
  • archive-linux-amd64 (19 MB)
  • archive-linux-arm64 (17 MB)
  • archive-windows-amd64 (31 MB)
  • archive-windows-arm64 (28 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (27 MB)
  • installer-dmg-darwin-arm64 (25 MB)
  • smart-mcp-proxymcpproxy-goS1N29G.dockerbuild (0 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 38359460609 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris
Dumbris merged commit d33f2f2 into main Oct 13, 2026
44 checks passed
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