diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2019-11-25 10:28:06 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2019-11-25 10:28:06 +0300 |
commit | 9000ea32a8fa2ee8e82f36380cba2c063f9cf570 (patch) | |
tree | ef1701d7e1a5384e21b6588152599852e03a8818 | |
parent | f756ebe2f9b8b12ea2a6922f2833e5edc5055db9 (diff) | |
parent | 5bbf674cf1fb26543c05643ca6de780e06a4b258 (diff) |
Merge branch 'jv-use-test-helper-in-gitaly-ssh-test' into 'master'
Use testhelper to build gitaly-ssh in test
See merge request gitlab-org/gitaly!1649
-rw-r--r-- | cmd/gitaly-ssh/auth_test.go | 9 | ||||
-rw-r--r-- | cmd/gitaly-ssh/testhelper_test.go | 25 |
2 files changed, 25 insertions, 9 deletions
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go index 365acc213..55bac2e2f 100644 --- a/cmd/gitaly-ssh/auth_test.go +++ b/cmd/gitaly-ssh/auth_test.go @@ -20,12 +20,6 @@ import ( "google.golang.org/grpc" ) -func buildGitalySSH(t *testing.T) { - // Build the test-binary that we need - os.Remove("gitaly-ssh") - testhelper.MustRunCommand(nil, nil, "go", "build", "gitlab.com/gitlab-org/gitaly/cmd/gitaly-ssh") -} - func TestConnectivity(t *testing.T) { config.Config.TLS = config.TLS{ CertPath: "testdata/certs/gitalycert.pem", @@ -37,11 +31,8 @@ func TestConnectivity(t *testing.T) { certPoolPath := path.Join(cwd, "testdata/certs") - buildGitalySSH(t) testRepo := testhelper.TestRepository() - gitalySSHPath := path.Join(cwd, "gitaly-ssh") - socketPath := testhelper.GetTemporaryGitalySocketFileName() relativeSocketPath := "testdata/gitaly.socket" diff --git a/cmd/gitaly-ssh/testhelper_test.go b/cmd/gitaly-ssh/testhelper_test.go new file mode 100644 index 000000000..f8dec89e8 --- /dev/null +++ b/cmd/gitaly-ssh/testhelper_test.go @@ -0,0 +1,25 @@ +package main + +import ( + "os" + "path" + "testing" + + "gitlab.com/gitlab-org/gitaly/internal/config" + "gitlab.com/gitlab-org/gitaly/internal/testhelper" +) + +var gitalySSHPath string + +func TestMain(m *testing.M) { + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + defer testhelper.MustHaveNoChildProcess() + + testhelper.ConfigureGitalySSH() + gitalySSHPath = path.Join(config.Config.BinDir, "gitaly-ssh") + + return m.Run() +} |