mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: use filepath to construct mcp test write path (#19808)
Hopefully fixes https://github.com/coder/internal/issues/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?
This commit is contained in:
@@ -615,14 +615,17 @@ func TestTools(t *testing.T) {
|
||||
tb, err := toolsdk.NewDeps(client)
|
||||
require.NoError(t, err)
|
||||
|
||||
tmpdir := os.TempDir()
|
||||
filePath := filepath.Join(tmpdir, "write")
|
||||
|
||||
_, err = testTool(t, toolsdk.WorkspaceWriteFile, tb, toolsdk.WorkspaceWriteFileArgs{
|
||||
Workspace: workspace.Name,
|
||||
Path: "/test/some/path",
|
||||
Path: filePath,
|
||||
Content: []byte("content"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
b, err := afero.ReadFile(fs, "/test/some/path")
|
||||
b, err := afero.ReadFile(fs, filePath)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("content"), b)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user