Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: preventing dubios ownership repository error on git unit tests #2499

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading