Skip to content

Commit 3272622

Browse files
committed
test(gate): skip Linux-only fixture/driver tests on Windows
The new Spec 081 gate helpers are Linux-only: cmd/mcpfixture is built and run exclusively on the ubuntu-latest gate runner and inside the linux/amd64 Docker image, and cmd/release-gate runs only on the gate runner. Their tests exercise Unix-only semantics — exec of the built fixture + SIGTERM restart, and a copyFile owner-execute (0o100) bit — which the cross-compilation 'PR Build' Windows job cannot satisfy (exec-not-found without .exe, no Unix perm bits), turning them red. Guard them with runtime.GOOS=="windows" skips; full coverage is retained on Linux where these helpers actually run.
1 parent 5fb9542 commit 3272622

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

cmd/mcpfixture/main_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"os/exec"
1010
"path/filepath"
11+
"runtime"
1112
"syscall"
1213
"testing"
1314
"time"
@@ -16,6 +17,18 @@ import (
1617
"github.com/mark3labs/mcp-go/mcp"
1718
)
1819

20+
// skipIfWindows guards the exec/signal-based transport tests. The fixture binary
21+
// is Linux-only gate infrastructure — it is built and run exclusively on the
22+
// ubuntu-latest gate runner and inside the linux/amd64 Docker image, never on
23+
// Windows. The tests spawn the real process and exercise Unix signal/restart
24+
// semantics (SIGTERM) that Windows does not support, so they are skipped there.
25+
func skipIfWindows(t *testing.T) {
26+
t.Helper()
27+
if runtime.GOOS == "windows" {
28+
t.Skip("mcpfixture exec/signal transport tests are Linux-only gate infra (gate runs on ubuntu-latest)")
29+
}
30+
}
31+
1932
// fixtureBin is the compiled fixture binary, built once in TestMain. The
2033
// transport tests exercise the real executable (exec-based) so the SIGTERM →
2134
// restart behavior (FR-007d, FR-022) is proven against what the gate and the
@@ -173,6 +186,7 @@ func roundTrip(t *testing.T, c *client.Client) pingResult {
173186
// --- stdio -----------------------------------------------------------------
174187

175188
func TestStdioRoundTripAndRestart(t *testing.T) {
189+
skipIfWindows(t)
176190
newStdioClient := func() *client.Client {
177191
c, err := client.NewStdioMCPClient(fixtureBin, nil, "--transport", "stdio")
178192
if err != nil {
@@ -199,6 +213,7 @@ func TestStdioRoundTripAndRestart(t *testing.T) {
199213
}
200214

201215
func TestStdioSIGTERMExitsCleanly(t *testing.T) {
216+
skipIfWindows(t)
202217
cmd := exec.Command(fixtureBin, "--transport", "stdio")
203218
stdin, err := cmd.StdinPipe()
204219
if err != nil {
@@ -220,12 +235,14 @@ func TestStdioSIGTERMExitsCleanly(t *testing.T) {
220235
// --- http / sse ------------------------------------------------------------
221236

222237
func TestHTTPRoundTripAndRestart(t *testing.T) {
238+
skipIfWindows(t)
223239
testNetworkTransport(t, transportHTTP, func(port int) (*client.Client, error) {
224240
return client.NewStreamableHttpClient(fmt.Sprintf("http://127.0.0.1:%d/mcp", port))
225241
})
226242
}
227243

228244
func TestSSERoundTripAndRestart(t *testing.T) {
245+
skipIfWindows(t)
229246
testNetworkTransport(t, transportSSE, func(port int) (*client.Client, error) {
230247
return client.NewSSEMCPClient(fmt.Sprintf("http://127.0.0.1:%d/sse", port))
231248
})

cmd/release-gate/invariants_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http/httptest"
99
"os"
1010
"path/filepath"
11+
"runtime"
1112
"strings"
1213
"sync"
1314
"testing"
@@ -523,6 +524,13 @@ func TestBuildGateConfig_DockerIsolationShape(t *testing.T) {
523524
}
524525

525526
func TestFreePortAndCopyFile(t *testing.T) {
527+
// The exec-bit assertion below (0o100) is Unix-only; Windows has no Unix
528+
// permission bits, so copyFile cannot set an owner-execute bit there. The
529+
// gate driver runs exclusively on the ubuntu-latest runner, so this staging
530+
// helper is only ever exercised on Linux.
531+
if runtime.GOOS == "windows" {
532+
t.Skip("copyFile exec-bit staging is Linux-only gate infra (gate runs on ubuntu-latest)")
533+
}
526534
p, err := freePort()
527535
if err != nil || p == 0 {
528536
t.Fatalf("freePort: %d %v", p, err)

0 commit comments

Comments
 (0)