diff options
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testhelper.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index e0e6251c4..3107824e5 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -360,3 +360,28 @@ func cloneTestRepo(t *testing.T, bare bool) (repo *pb.Repository, repoPath strin return repo, repoPath, func() { os.RemoveAll(repoPath) } } + +// ConfigureGitalySSH configures the gitaly-ssh command for tests +func ConfigureGitalySSH() { + var err error + + config.Config.BinDir, err = filepath.Abs("testdata/gitaly-libexec") + if err != nil { + log.Fatal(err) + } + + goBuildArgs := []string{ + "build", + "-o", + path.Join(config.Config.BinDir, "gitaly-ssh"), + "gitlab.com/gitlab-org/gitaly/cmd/gitaly-ssh", + } + MustRunCommand(nil, nil, "go", goBuildArgs...) +} + +// GetRepositoryRefs gives a list of each repository ref as a string +func GetRepositoryRefs(t *testing.T, repoPath string) string { + refs := MustRunCommand(t, nil, "git", "-C", repoPath, "for-each-ref") + + return string(refs) +} |