Skip to content

Commit dd7dc21

Browse files
committed
fix(ci): исправлены проблемы с тестами
- исправлен TestWorkspace_ListFiles для Windows (нормализация путей) - добавлен таймаут для Install команды на macOS (исправление race condition)
1 parent f34ee37 commit dd7dc21

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

internal/features/process/infrastructure/helper/installer_darwin.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
package helper
55

66
import (
7+
"context"
78
"fmt"
89
"os"
910
"os/exec"
11+
"time"
1012
)
1113

1214
const (
@@ -80,9 +82,15 @@ func (i *darwinInstaller) Install(helperBinaryPath string) error {
8082
tmpPlist, plistPath, plistPath,
8183
plistPath)
8284

83-
cmd := exec.Command("osascript", "-e", script)
85+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
86+
defer cancel()
87+
88+
cmd := exec.CommandContext(ctx, "osascript", "-e", script)
8489
output, err := cmd.CombinedOutput()
8590
if err != nil {
91+
if ctx.Err() == context.DeadlineExceeded {
92+
return fmt.Errorf("installation timeout: command took too long")
93+
}
8694
return fmt.Errorf("installation failed: %w (output: %s)", err, string(output))
8795
}
8896

internal/features/scripting/infrastructure/compilers/workspace_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,15 @@ func TestWorkspace_ListFiles(t *testing.T) {
307307
}
308308

309309
// Проверяем наличие каждого файла
310+
// Нормализуем пути для кроссплатформенного сравнения
311+
normalizedListed := make(map[string]bool)
312+
for _, listed := range listedFiles {
313+
normalizedListed[filepath.ToSlash(listed)] = true
314+
}
315+
310316
for filename := range files {
311-
found := false
312-
for _, listed := range listedFiles {
313-
if listed == filename {
314-
found = true
315-
break
316-
}
317-
}
318-
if !found {
317+
normalizedFilename := filepath.ToSlash(filename)
318+
if !normalizedListed[normalizedFilename] {
319319
t.Errorf("File %s not found in list", filename)
320320
}
321321
}

0 commit comments

Comments
 (0)