Skip to content

Commit 98982cc

Browse files
committed
revert path normailization + increase timeout on windows (runners are
slower) Signed-off-by: Guillaume de Rouville <guillaume@dagger.io>
1 parent 21b0235 commit 98982cc

4 files changed

Lines changed: 26 additions & 24 deletions

File tree

environment/integration/integration_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"os"
77
"path/filepath"
8+
"runtime"
89
"strconv"
910
"strings"
1011
"testing"
@@ -202,14 +203,17 @@ func TestLargeProjectPerformance(t *testing.T) {
202203
WithRepository(t, "large_project_performance", largeProjectSetup, func(t *testing.T, repo *repository.Repository, user *UserActions) {
203204
env := user.CreateEnvironment("Performance Test", "Testing performance with large project")
204205

205-
// Time file operations
206206
start := time.Now()
207207
user.FileWrite(env.ID, "new.txt", "test", "Test write performance")
208208
writeTime := time.Since(start)
209209

210210
t.Logf("File write took: %v", writeTime)
211211

212-
assert.LessOrEqual(t, writeTime, 2*time.Second, "File write should be fast")
212+
threshold := 2 * time.Second
213+
if runtime.GOOS == "windows" {
214+
threshold = 5 * time.Second
215+
}
216+
assert.LessOrEqual(t, writeTime, threshold, "File write should be fast")
213217
})
214218
})
215219
}

repository/git.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"os/exec"
1212
"path/filepath"
1313
"regexp"
14-
"runtime"
1514
"slices"
1615
"strings"
1716

@@ -82,12 +81,12 @@ func getContainerUseRemote(ctx context.Context, repo string) (string, error) {
8281

8382
cuRemote = strings.TrimSpace(cuRemote)
8483

85-
// Convert file:// URLs back to paths on Windows
86-
if runtime.GOOS == "windows" && strings.HasPrefix(cuRemote, "file://") {
87-
// Remove file:// prefix and convert slashes back
88-
cuRemote = strings.TrimPrefix(cuRemote, "file://")
89-
cuRemote = filepath.FromSlash(cuRemote)
90-
}
84+
// // Convert file:// URLs back to paths on Windows
85+
// if runtime.GOOS == "windows" && strings.HasPrefix(cuRemote, "file://") {
86+
// // Remove file:// prefix and convert slashes back
87+
// cuRemote = strings.TrimPrefix(cuRemote, "file://")
88+
// cuRemote = filepath.FromSlash(cuRemote)
89+
// }
9190

9291
return cuRemote, nil
9392
}

repository/repository.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,21 @@ func (r *Repository) ensureUserRemote(ctx context.Context) error {
152152
if !errors.Is(err, os.ErrNotExist) {
153153
return err
154154
}
155-
// Convert Windows paths to file:// URLs for git remotes
155+
// // Convert Windows paths to file:// URLs for git remotes
156156
remotePath := r.forkRepoPath
157-
if runtime.GOOS == "windows" {
158-
remotePath = "file://" + filepath.ToSlash(r.forkRepoPath)
159-
}
157+
// if runtime.GOOS == "windows" {
158+
// remotePath = "file://" + filepath.ToSlash(r.forkRepoPath)
159+
// }
160160
_, err := RunGitCommand(ctx, r.userRepoPath, "remote", "add", containerUseRemote, remotePath)
161161
return err
162162
}
163163

164164
if currentForkPath != r.forkRepoPath {
165-
// Convert Windows paths to file:// URLs for git remotes
165+
// // Convert Windows paths to file:// URLs for git remotes
166166
remotePath := r.forkRepoPath
167-
if runtime.GOOS == "windows" {
168-
remotePath = "file://" + filepath.ToSlash(r.forkRepoPath)
169-
}
167+
// if runtime.GOOS == "windows" {
168+
// remotePath = "file://" + filepath.ToSlash(r.forkRepoPath)
169+
// }
170170
_, err := RunGitCommand(ctx, r.userRepoPath, "remote", "set-url", containerUseRemote, remotePath)
171171
return err
172172
}

repository/repository_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"os"
66
"path/filepath"
7-
"runtime"
87
"strings"
98
"testing"
109

@@ -66,12 +65,12 @@ func TestRepositoryOpen(t *testing.T) {
6665
require.NoError(t, err)
6766
remote = strings.TrimSpace(remote)
6867

69-
// Convert file:// URLs back to paths on Windows
70-
if runtime.GOOS == "windows" && strings.HasPrefix(remote, "file://") {
71-
// Remove file:// prefix and convert slashes back
72-
remote = strings.TrimPrefix(remote, "file://")
73-
remote = filepath.FromSlash(remote)
74-
}
68+
// // Convert file:// URLs back to paths on Windows
69+
// if runtime.GOOS == "windows" && strings.HasPrefix(remote, "file://") {
70+
// // Remove file:// prefix and convert slashes back
71+
// remote = strings.TrimPrefix(remote, "file://")
72+
// remote = filepath.FromSlash(remote)
73+
// }
7574

7675
assert.Equal(t, repo.forkRepoPath, remote)
7776
})

0 commit comments

Comments
 (0)