Skip to content

Commit 1fa00b4

Browse files
committed
fix(test): use mockmcp.exe on Windows for go build -o output
exec.Command requires a .exe path on windows-latest CI; without it the built binary path is not recognized as executable. Made-with: Cursor
1 parent 9a05612 commit 1fa00b4

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

internal/tools/mcp/mcp_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ import (
44
"context"
55
"os/exec"
66
"path/filepath"
7+
"runtime"
78
"testing"
89

910
"github.com/LAA-Software-Engineering/agentic-control-plane/internal/spec"
1011
)
1112

1213
func mockMCPExecutable(t *testing.T) string {
1314
t.Helper()
14-
out := filepath.Join(t.TempDir(), "mockmcp")
15+
name := "mockmcp"
16+
if runtime.GOOS == "windows" {
17+
name += ".exe"
18+
}
19+
out := filepath.Join(t.TempDir(), name)
1520
cmd := exec.Command("go", "build", "-o", out, "./testdata/mockmcp")
1621
cmd.Dir = "."
1722
if b, err := cmd.CombinedOutput(); err != nil {

internal/tools/tools_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"os/exec"
77
"path/filepath"
8+
"runtime"
89
"testing"
910

1011
"github.com/LAA-Software-Engineering/agentic-control-plane/internal/spec"
@@ -79,7 +80,11 @@ func TestParseUses_githubExample(t *testing.T) {
7980

8081
func mockMCPBinaryFromTools(t *testing.T) string {
8182
t.Helper()
82-
out := filepath.Join(t.TempDir(), "mockmcp")
83+
name := "mockmcp"
84+
if runtime.GOOS == "windows" {
85+
name += ".exe"
86+
}
87+
out := filepath.Join(t.TempDir(), name)
8388
cmd := exec.Command("go", "build", "-o", out, "./mcp/testdata/mockmcp")
8489
cmd.Dir = "."
8590
if b, err := cmd.CombinedOutput(); err != nil {

0 commit comments

Comments
 (0)