Skip to content

Commit c9d775d

Browse files
committed
fix tests
1 parent fdf37e5 commit c9d775d

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

pkg/agentfs/docker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestLoadDockerFiles(t *testing.T) {
1616
}
1717

1818
for _, file := range expectedFiles {
19-
bytes, err := fs.ReadFile(file)
19+
bytes, err := embedfs.ReadFile(file)
2020
if err != nil {
2121
t.Fatalf("failed to read Dockerfile: %v", err)
2222
}

pkg/agentfs/tar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func UploadTarball(
9090
// need to ensure we use a dockerignore file
9191
// if we fail to load a dockerignore file, we have to exit
9292
if !foundDockerIgnore {
93-
dockerIgnoreContent, err := fs.ReadFile(directory, path.Join("examples", string(projectType)+".dockerignore"))
93+
dockerIgnoreContent, err := embedfs.ReadFile(path.Join("examples", string(projectType)+".dockerignore"))
9494
if err != nil {
9595
return fmt.Errorf("failed to load exclude file %s: %w", string(projectType), err)
9696
}

pkg/agentfs/tar_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestUploadTarball(t *testing.T) {
5454
}))
5555
defer mockServer.Close()
5656

57-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
57+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
5858
require.NoError(t, err)
5959
}
6060

@@ -96,7 +96,7 @@ func TestUploadTarballPost(t *testing.T) {
9696
}))
9797
defer mockServer.Close()
9898

99-
err = UploadTarball(tmpDir, "", &livekit.PresignedPostRequest{
99+
err = UploadTarball(os.DirFS(tmpDir), "", &livekit.PresignedPostRequest{
100100
Url: mockServer.URL,
101101
Values: map[string]string{},
102102
}, []string{}, ProjectTypePythonPip)
@@ -136,15 +136,15 @@ func TestUploadTarballFilePermissions(t *testing.T) {
136136
// https://learn.microsoft.com/en-us/windows/win32/secauthz/access-control-lists
137137
//
138138
if runtime.GOOS != "windows" {
139-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
139+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
140140
require.Error(t, err)
141141
require.Contains(t, err.Error(), "permission denied")
142142
}
143143

144144
err = os.Remove(restrictedFile)
145145
require.NoError(t, err)
146146

147-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
147+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
148148
require.NoError(t, err)
149149
}
150150

@@ -239,7 +239,7 @@ func TestUploadTarballDotfiles(t *testing.T) {
239239
}))
240240
defer mockServer.Close()
241241

242-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
242+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
243243
require.NoError(t, err)
244244

245245
contents := readTarContents(t, tarBuffer.Bytes())
@@ -323,7 +323,7 @@ func TestUploadTarballDeepDirectories(t *testing.T) {
323323
}))
324324
defer mockServer.Close()
325325

326-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
326+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
327327
require.NoError(t, err)
328328

329329
contents := readTarContents(t, tarBuffer.Bytes())
@@ -420,7 +420,7 @@ venv/
420420
}))
421421
defer mockServer.Close()
422422

423-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{}, ProjectTypePythonPip)
423+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{}, ProjectTypePythonPip)
424424
require.NoError(t, err)
425425

426426
contents := readTarContents(t, tarBuffer.Bytes())
@@ -524,7 +524,7 @@ func TestUploadTarballWithPipPythonProject(t *testing.T) {
524524
}))
525525
defer mockServer.Close()
526526

527-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypePythonPip)
527+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypePythonPip)
528528
require.NoError(t, err)
529529

530530
contents := readTarContents(t, tarBuffer.Bytes())
@@ -617,7 +617,7 @@ func TestUploadTarballWithUvPythonProject(t *testing.T) {
617617
}))
618618
defer mockServer.Close()
619619

620-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypePythonUV)
620+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypePythonUV)
621621
require.NoError(t, err)
622622

623623
contents := readTarContents(t, tarBuffer.Bytes())
@@ -717,7 +717,7 @@ func TestUploadTarballWithNodeProject(t *testing.T) {
717717
}))
718718
defer mockServer.Close()
719719

720-
err = UploadTarball(tmpDir, mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypeNode)
720+
err = UploadTarball(os.DirFS(tmpDir), mockServer.URL, nil, []string{"**/livekit.toml"}, ProjectTypeNode)
721721
require.NoError(t, err)
722722

723723
contents := readTarContents(t, tarBuffer.Bytes())

0 commit comments

Comments
 (0)