Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-24 15:23:08 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-30 09:09:53 +0300
commit1d4c4f66e2e1be872d11c4c6c59415607a992845 (patch)
tree4a5a39ad7414d0e49587647fa23ee013136fc01e
parenta6c5964bb455f77a0c79898f0b99c4c7df3aee3a (diff)
gitaly-lfs-smudge: Move test setup functions into separate file
Move functions required for the test setup into a separate file according to our coding style.
-rw-r--r--cmd/gitaly-lfs-smudge/lfs_smudge_test.go19
-rw-r--r--cmd/gitaly-lfs-smudge/testhelper_test.go29
2 files changed, 29 insertions, 19 deletions
diff --git a/cmd/gitaly-lfs-smudge/lfs_smudge_test.go b/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
index a508778ca..32f8e254e 100644
--- a/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
+++ b/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
@@ -50,29 +50,10 @@ type mapConfig struct {
env map[string]string
}
-func TestMain(m *testing.M) {
- testhelper.Run(m)
-}
-
func (m *mapConfig) Get(key string) string {
return m.env[key]
}
-func runTestServer(t *testing.T, options gitlab.TestServerOptions) (config.Gitlab, func()) {
- tempDir := testhelper.TempDir(t)
-
- gitlab.WriteShellSecretFile(t, tempDir, secretToken)
- secretFilePath := filepath.Join(tempDir, ".gitlab_shell_secret")
-
- serverURL, serverCleanup := gitlab.NewTestServer(t, options)
-
- c := config.Gitlab{URL: serverURL, SecretFile: secretFilePath, HTTPSettings: config.HTTPSettings{CAFile: certPath}}
-
- return c, func() {
- serverCleanup()
- }
-}
-
func TestSuccessfulLfsSmudge(t *testing.T) {
testCases := []struct {
desc string
diff --git a/cmd/gitaly-lfs-smudge/testhelper_test.go b/cmd/gitaly-lfs-smudge/testhelper_test.go
new file mode 100644
index 000000000..3d4d4f31f
--- /dev/null
+++ b/cmd/gitaly-lfs-smudge/testhelper_test.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "path/filepath"
+ "testing"
+
+ "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/gitlab"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
+)
+
+func TestMain(m *testing.M) {
+ testhelper.Run(m)
+}
+
+func runTestServer(t *testing.T, options gitlab.TestServerOptions) (config.Gitlab, func()) {
+ tempDir := testhelper.TempDir(t)
+
+ gitlab.WriteShellSecretFile(t, tempDir, secretToken)
+ secretFilePath := filepath.Join(tempDir, ".gitlab_shell_secret")
+
+ serverURL, serverCleanup := gitlab.NewTestServer(t, options)
+
+ c := config.Gitlab{URL: serverURL, SecretFile: secretFilePath, HTTPSettings: config.HTTPSettings{CAFile: certPath}}
+
+ return c, func() {
+ serverCleanup()
+ }
+}