Skip to content

Commit b7e0266

Browse files
authored
fix: skip bash tests on Windows (#19277)
Adds Windows compatibility to toolsdk tests This PR adds Windows compatibility to the toolsdk tests by: 1. Adding build constraints to exclude bash_test.go from running on Windows 2. Skipping the WorkspaceSSHExec test on Windows platforms with a clear message These changes ensure tests run properly across all supported platforms. Related to coder/internal#798 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent dadeab8 commit b7e0266

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

codersdk/toolsdk/bash_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package toolsdk_test
22

33
import (
44
"context"
5+
"runtime"
56
"testing"
67

78
"github.com/stretchr/testify/require"
@@ -14,6 +15,9 @@ import (
1415

1516
func TestWorkspaceBash(t *testing.T) {
1617
t.Parallel()
18+
if runtime.GOOS == "windows" {
19+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
20+
}
1721

1822
t.Run("ValidateArgs", func(t *testing.T) {
1923
t.Parallel()
@@ -97,6 +101,9 @@ func TestWorkspaceBash(t *testing.T) {
97101

98102
func TestNormalizeWorkspaceInput(t *testing.T) {
99103
t.Parallel()
104+
if runtime.GOOS == "windows" {
105+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
106+
}
100107

101108
testCases := []struct {
102109
name string
@@ -151,6 +158,9 @@ func TestNormalizeWorkspaceInput(t *testing.T) {
151158

152159
func TestAllToolsIncludesBash(t *testing.T) {
153160
t.Parallel()
161+
if runtime.GOOS == "windows" {
162+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
163+
}
154164

155165
// Verify that WorkspaceBash is included in the All slice
156166
found := false
@@ -169,6 +179,9 @@ func TestAllToolsIncludesBash(t *testing.T) {
169179

170180
func TestWorkspaceBashTimeout(t *testing.T) {
171181
t.Parallel()
182+
if runtime.GOOS == "windows" {
183+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
184+
}
172185

173186
t.Run("TimeoutDefaultValue", func(t *testing.T) {
174187
t.Parallel()
@@ -251,6 +264,9 @@ func TestWorkspaceBashTimeout(t *testing.T) {
251264

252265
func TestWorkspaceBashTimeoutIntegration(t *testing.T) {
253266
t.Parallel()
267+
if runtime.GOOS == "windows" {
268+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
269+
}
254270

255271
t.Run("ActualTimeoutBehavior", func(t *testing.T) {
256272
t.Parallel()
@@ -338,6 +354,9 @@ func TestWorkspaceBashTimeoutIntegration(t *testing.T) {
338354

339355
func TestWorkspaceBashBackgroundIntegration(t *testing.T) {
340356
t.Parallel()
357+
if runtime.GOOS == "windows" {
358+
t.Skip("Skipping on Windows: Workspace MCP bash tools rely on a Unix-like shell (bash) and POSIX/SSH semantics. Use Linux/macOS or WSL for these tests.")
359+
}
341360

342361
t.Run("BackgroundCommandCapturesOutput", func(t *testing.T) {
343362
t.Parallel()

codersdk/toolsdk/toolsdk_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"os"
7+
"runtime"
78
"sort"
89
"sync"
910
"testing"
@@ -397,6 +398,9 @@ func TestTools(t *testing.T) {
397398
})
398399

399400
t.Run("WorkspaceSSHExec", func(t *testing.T) {
401+
if runtime.GOOS == "windows" {
402+
t.Skip("WorkspaceSSHExec is not supported on Windows")
403+
}
400404
// Setup workspace exactly like main SSH tests
401405
client, workspace, agentToken := setupWorkspaceForAgent(t)
402406

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy