Repository navigation
test: skip fsync in internal/runtime and internal/storage tests (Windows PR Build timeout) - #1613
Merged
Merged
Conversation
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.
Deploying mcpproxy-docs with
|
| 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 |
|
Codecov Report❌ Patch coverage is
📢 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 38359460609 --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
internal/runtimetook ~472s in the PR BuildBuild Binaries (windows-latest, windows, amd64, …)job, whosego testruns with the default 10m timeout. It timed out once on #1608 and passed on rerun.Timings from run 38347737392 (Windows job 115142245158):
TestConfigCommit_CommitPathsConvergeTestReviewPayload_MasksSecretsInsideShellCommandArgsTestUnquarantineViaConfigReload_LeavesIndexAloneThe 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 toconfig.db(bbolt fsync per commit) and creates a Bleve index (scorchroot.bolt).FlushFileBuffersis very expensive on the Windows runner.TestConfigCommit_CommitPathsConvergeruns 200 rounds of five fsynced commit paths.Fix
config.DisableWriteSyncForTesting()makesatomicWriteFileModeskip the fsync before the rename.storage.DisableSyncForTesting()makesNewBoltDBopen with bboltNoSync.TestMainininternal/runtimecalls both and also setsbbolt.DefaultOptions.NoSync, which Bleve's scorch copies forroot.bolt. A secondTestMainininternal/storage(~147s on Windows) callsDisableSyncForTesting.Production code paths are unchanged: both switches default off, and only
_test.gofiles 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)
internal/runtime(no race)TestConfigCommit_CommitPathsConvergego test -raceruntime/storage/configWindows results (PR Build, windows-latest amd64)
internal/runtimeinternal/storageTestConfigCommit_CommitPathsConvergeNo test failures in the job.
🤖 Generated with Claude Code