Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3171ad

Browse files
committed
fix: use filepath to construct mcp test write path
Hopefully fixes the test flake: file path must be absolute: "/test/some/path" In Windows, starting with `/` is not considered absolute. No idea how this only flakes rather than always failing though.
1 parent 30330ab commit a3171ad

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codersdk/toolsdk/toolsdk_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,17 @@ func TestTools(t *testing.T) {
569569
tb, err := toolsdk.NewDeps(client)
570570
require.NoError(t, err)
571571

572+
tmpdir := os.TempDir()
573+
filePath := filepath.Join(tmpdir, "write")
574+
572575
_, err = testTool(t, toolsdk.WorkspaceWriteFile, tb, toolsdk.WorkspaceWriteFileArgs{
573576
Workspace: workspace.Name,
574-
Path: "/test/some/path",
577+
Path: filePath,
575578
Content: []byte("content"),
576579
})
577580
require.NoError(t, err)
578581

579-
b, err := afero.ReadFile(fs, "/test/some/path")
582+
b, err := afero.ReadFile(fs, filePath)
580583
require.NoError(t, err)
581584
require.Equal(t, []byte("content"), b)
582585
})

0 commit comments

Comments
 (0)