Skip to content

Commit 0aad8d5

Browse files
authored
test(runtime): skip heavy quarantine property tests on Windows (#689)
The three rapid-based property tests (TestRapidQuarantineStateMachine, TestRapidInvariant_ChangedNeverAutoApproved, TestRapidInvariant_PendingNeverAutoApproved) each create and tear down hundreds of BBolt-backed Runtimes per rapid.Check run. Under -race they take several minutes; on Windows the slower file IO/timers push them past the 5m package timeout of the Unit Tests (windows-latest) job, which runs 'go test -race -timeout 5m ./...' without -short. This produced flaky 'panic: test timed out after 5m0s' reds in internal/runtime unrelated to any PR change (#675, #685, #684). The existing testing.Short() guards never fire because the job omits -short. Add a documented Windows skip (mirroring apply_config_restart_test.go) to the offending tests only. The invariants they assert are platform-independent, so Linux/macOS coverage plus the dedicated heavy-runtime CI job is sufficient. The global timeout is left untouched. Related #MCP-2493
1 parent 113a12c commit 0aad8d5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

internal/runtime/tool_quarantine_invariant_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package runtime
33
import (
44
"fmt"
55
"os"
6+
"runtime"
67
"testing"
78

89
"github.com/stretchr/testify/assert"
@@ -14,6 +15,26 @@ import (
1415
"github.com/smart-mcp-proxy/mcpproxy-go/internal/storage"
1516
)
1617

18+
// skipQuarantinePropertyTestOnWindows skips the rapid-based property tests below
19+
// on Windows. Each rapid.Check iteration creates and tears down a full
20+
// BBolt-backed Runtime in a temp dir; with hundreds of iterations under `-race`
21+
// these tests run for several minutes. On Windows the slower file IO/timers push
22+
// them past the 5m package timeout of the Unit Tests (windows-latest) job, which
23+
// runs `go test -race -timeout 5m ./...` without `-short`, producing flaky
24+
// "panic: test timed out after 5m0s" reds in internal/runtime (MCP-2493).
25+
//
26+
// The invariants these tests assert (tool-approval hash + storage state machine)
27+
// are platform-independent, so full coverage on Linux/macOS — plus the dedicated
28+
// heavy-runtime CI job — is sufficient. This mirrors the existing Windows skip in
29+
// apply_config_restart_test.go.
30+
func skipQuarantinePropertyTestOnWindows(t *testing.T) {
31+
t.Helper()
32+
if runtime.GOOS == "windows" {
33+
t.Skip("heavy rapid property test exceeds the 5m Windows -race package timeout (MCP-2493); " +
34+
"platform-independent invariants are fully covered on Linux/macOS and the heavy-runtime CI job")
35+
}
36+
}
37+
1738
// =============================================================================
1839
// Unit tests for assertToolApprovalInvariant
1940
// =============================================================================
@@ -356,6 +377,7 @@ func TestRapidQuarantineStateMachine(t *testing.T) {
356377
if testing.Short() {
357378
t.Skip("heavy property test (~270s under -race); runs in the stress-tests CI job")
358379
}
380+
skipQuarantinePropertyTestOnWindows(t)
359381
rapid.Check(t, func(t *rapid.T) {
360382
// Set up runtime with quarantine enabled
361383
tempDir, err := os.MkdirTemp("", "quarantine-rapid-*")
@@ -504,6 +526,7 @@ func TestRapidInvariant_ChangedNeverAutoApproved(t *testing.T) {
504526
if testing.Short() {
505527
t.Skip("heavy property test (~70s under -race); runs in the stress-tests CI job")
506528
}
529+
skipQuarantinePropertyTestOnWindows(t)
507530
rapid.Check(t, func(t *rapid.T) {
508531
tempDir, err := os.MkdirTemp("", "quarantine-changed-*")
509532
if err != nil {
@@ -585,6 +608,7 @@ func TestRapidInvariant_ChangedNeverAutoApproved(t *testing.T) {
585608
// TestRapidInvariant_PendingNeverAutoApproved is a focused property test that
586609
// verifies pending tools never auto-approve when quarantine is enabled.
587610
func TestRapidInvariant_PendingNeverAutoApproved(t *testing.T) {
611+
skipQuarantinePropertyTestOnWindows(t)
588612
rapid.Check(t, func(t *rapid.T) {
589613
tempDir, err := os.MkdirTemp("", "quarantine-pending-*")
590614
if err != nil {

0 commit comments

Comments
 (0)