diff --git a/adk/backend/agentkit/code_template.go b/adk/backend/agentkit/code_template.go index 77481164c..b58056e7c 100644 --- a/adk/backend/agentkit/code_template.go +++ b/adk/backend/agentkit/code_template.go @@ -61,7 +61,7 @@ try: with os.scandir(path) as it: for entry in sorted(it, key=lambda e: e.name): result = {{ - 'path': entry.name, + 'path': os.path.join(path, entry.name), 'is_dir': entry.is_dir(follow_symlinks=False) }} print(json.dumps(result)) diff --git a/adk/backend/agentkit/sandbox_test.go b/adk/backend/agentkit/sandbox_test.go index afcf3b492..f0d35398e 100644 --- a/adk/backend/agentkit/sandbox_test.go +++ b/adk/backend/agentkit/sandbox_test.go @@ -28,8 +28,8 @@ import ( "github.com/stretchr/testify/require" ) -// TestNewArkSandbox tests the constructor for ArkSandbox. -func TestNewArkSandbox(t *testing.T) { +// TestNewSandboxToolSandbox tests the constructor for ArkSandbox. +func TestNewSandboxToolSandbox(t *testing.T) { t.Run("Success: ValidConfig", func(t *testing.T) { config := &Config{ AccessKeyID: "test-ak", @@ -176,7 +176,7 @@ func createMockResponse(t *testing.T, success bool, outputText, eName, eValue st return finalResBytes } -func TestArkSandbox_FileSystemMethods(t *testing.T) { +func TestSandboxToolFileSystemMethods(t *testing.T) { s, server := setupTest(t) defer server.Close() diff --git a/adk/backend/local/local.go b/adk/backend/local/local.go index 7f36fa8da..edfdc9993 100644 --- a/adk/backend/local/local.go +++ b/adk/backend/local/local.go @@ -98,7 +98,7 @@ func (s *backend) LsInfo(ctx context.Context, req *filesystem.LsInfoRequest) ([] var files []filesystem.FileInfo for _, entry := range entries { files = append(files, filesystem.FileInfo{ - Path: entry.Name(), + Path: filepath.Join(path, entry.Name()), }) } diff --git a/adk/backend/local/local_test.go b/adk/backend/local/local_test.go index 04c4d0111..51d6dbac1 100644 --- a/adk/backend/local/local_test.go +++ b/adk/backend/local/local_test.go @@ -52,8 +52,8 @@ func TestLsInfo(t *testing.T) { files, err := s.LsInfo(ctx, req) assert.NoError(t, err) assert.Len(t, files, 2) - assert.Equal(t, "file1.txt", files[0].Path) - assert.Equal(t, "subdir", files[1].Path) + assert.Equal(t, filepath.Join(dir, "file1.txt"), files[0].Path) + assert.Equal(t, filepath.Join(dir, "subdir"), files[1].Path) }) t.Run("list non-existent directory", func(t *testing.T) { @@ -442,7 +442,7 @@ func TestPathCleaning(t *testing.T) { // Should find test.txt and write_test.txt found := false for _, f := range files { - if f.Path == filename { + if f.Path == filepath.Join(dir, filename) { found = true break }