[test-improver] Improve tests for guard package (ConfigureGlobalCompilationCache) - #11415
Conversation
…CompilationCache Adds a subtest exercising the branch where newCompilationCache fails during creation (e.g. dir points at a regular file), ensuring the function returns immediately without touching or closing the existing global cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds coverage for failed global WASM compilation-cache creation while verifying the existing cache remains untouched.
Changes:
- Adds a regular-file-path failure scenario.
- Verifies fail-fast behavior and cache preservation.
Show a summary per file
| File | Description |
|---|---|
internal/guard/wasm_test.go |
Tests cache-creation failure handling. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. No FAIL conditions detected. References: §32082549694
|
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No write leaked through in any part. Run §32082549742.
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked. Run: §32082549616
|
File analyzed
internal/guard/wasm_test.go(tests forinternal/guard/wasm_lifecycle.go)Improvements made
Added a subtest to
TestWasmGuardCompilationCachecovering the early-return branch ofConfigureGlobalCompilationCachewherenewCompilationCachefails during creation (e.g., the cache directory argument points at a regular file instead of a directory). This verifies that:Closeis not invoked when the new cache creation fails, since the function must fail fast before ever touching the old cache.This exercises a previously-uncovered branch (
wasm_lifecycle.go:119-121) whereerr != nilfromnewCompilationCache(dir)causes an early return.Coverage before/after
ConfigureGlobalCompilationCache: 90.5% → 95.2%Package (
internal/guard) total: 95.8% → 95.9%Test output
Also verified:
go test -count=3 ./internal/guard/(stable, no flakes),go vet ./internal/guard/(clean),gofmt -l internal/guard/wasm_test.go(no issues).No production code was changed; only the test file was modified.