Skip to content

Commit 9bb0ba7

Browse files
committed
skip sudo test if sudo is not available
1 parent 9d589a9 commit 9bb0ba7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/mcp/server/builtin/tools/command/command_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ func TestTool_Command_Exec_Echo(t *testing.T) {
3333
func TestTool_Command_Exec_Sudo(t *testing.T) {
3434
c := getTestClient(t)
3535

36+
// check if sudo is available
37+
_, err := os.Stat("/usr/bin/sudo")
38+
if os.IsNotExist(err) {
39+
t.Skip("Skipping test, 'sudo' command not available on this system")
40+
return
41+
}
42+
3643
apScript, err := os.Create(path.Join(t.TempDir(), "ask_pass.sh"))
3744
require.NoError(t, err)
3845
require.NoError(t, os.Chmod(apScript.Name(), 0700)) // Make it executable

0 commit comments

Comments
 (0)