Skip to content

Commit

Permalink
test: preventing dubios ownership repository error on git unit tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrangelramos authored Sep 13, 2024
1 parent 81169a4 commit 84f4caf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ func ServeRepo(name string, t *testing.T) string {
repo = filepath.Base(path)
url = RunGitServer(abs, t)
)
// This is to prevent "fatal: detected dubious ownership in repository at <source_reposutory_path>" while executing
// unit tests on other environments (such as Prow CI)
cmd := exec.Command("git", "config", "--global", "--add", "safe.directory", abs)
_, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
return fmt.Sprintf("%v/%v", url, repo)
}

Expand Down

0 comments on commit 84f4caf

Please sign in to comment.