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

Skip to content

Commit c31768d

Browse files
authored
fix: use filepath to construct mcp test write path (#19808)
Hopefully fixes coder/internal#993 ``` file path must be absolute: "/test/some/path" ``` Not sure if this is the right fix though, since I am not sure how this only flakes rather than always failing. It looks like starting with `/` should not be considered absolute in Windows, but then how did it ever pass at all?
1 parent 18b0aca commit c31768d

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
@@ -615,14 +615,17 @@ func TestTools(t *testing.T) {
615615
tb, err := toolsdk.NewDeps(client)
616616
require.NoError(t, err)
617617

618+
tmpdir := os.TempDir()
619+
filePath := filepath.Join(tmpdir, "write")
620+
618621
_, err = testTool(t, toolsdk.WorkspaceWriteFile, tb, toolsdk.WorkspaceWriteFileArgs{
619622
Workspace: workspace.Name,
620-
Path: "/test/some/path",
623+
Path: filePath,
621624
Content: []byte("content"),
622625
})
623626
require.NoError(t, err)
624627

625-
b, err := afero.ReadFile(fs, "/test/some/path")
628+
b, err := afero.ReadFile(fs, filePath)
626629
require.NoError(t, err)
627630
require.Equal(t, []byte("content"), b)
628631
})

0 commit comments

Comments
 (0)