Skip to content

Commit bed5a75

Browse files
committed
test(remediation): remove duplicate helpers now shared with remy_test.go [IDE-2052]
1 parent 0488689 commit bed5a75

1 file changed

Lines changed: 1 addition & 35 deletions

File tree

domain/snyk/remediation/remy_provider_test.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"errors"
2222
"os"
23-
"os/exec"
2423
"path/filepath"
2524
"sync"
2625
"sync/atomic"
@@ -35,42 +34,9 @@ import (
3534
)
3635

3736
// ---------------------------------------------------------------------------
38-
// Helpers
37+
// Helpers (initGitRepo and commitFile are defined in remy_test.go)
3938
// ---------------------------------------------------------------------------
4039

41-
// initGitRepo creates a temporary directory and initializes a new git repo in it.
42-
func initGitRepo(t *testing.T) string {
43-
t.Helper()
44-
dir := t.TempDir()
45-
for _, args := range [][]string{
46-
{"init"},
47-
{"config", "user.email", "test@test.com"},
48-
{"config", "user.name", "Test"},
49-
} {
50-
cmd := exec.Command("git", append([]string{"-C", dir}, args...)...)
51-
cmd.Stdout = nil
52-
cmd.Stderr = nil
53-
require.NoError(t, cmd.Run(), "git %v", args)
54-
}
55-
return dir
56-
}
57-
58-
// commitFile writes content to name inside repo and commits it.
59-
func commitFile(t *testing.T, repo, name, content string) {
60-
t.Helper()
61-
path := filepath.Join(repo, name)
62-
require.NoError(t, os.WriteFile(path, []byte(content), 0644))
63-
for _, args := range [][]string{
64-
{"add", name},
65-
{"commit", "-m", "add " + name},
66-
} {
67-
cmd := exec.Command("git", append([]string{"-C", repo}, args...)...)
68-
cmd.Stdout = nil
69-
cmd.Stderr = nil
70-
require.NoError(t, cmd.Run(), "git %v", args)
71-
}
72-
}
73-
7440
// noopRunner is a fake remyRunner that makes no file changes.
7541
func noopRunner(_ context.Context, _ workflow.Engine, _, _ string) error {
7642
return nil

0 commit comments

Comments
 (0)