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>2020-11-12 16:34:30 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-11-17 10:07:45 +0300
commit8a1827994ee35afc7b49a62e714546b111711fb2 (patch)
treed12c77c2c2fccc19c2a5876606a87d28a5a941b2 /internal/testhelper/testhelper.go
parent879806b1d636854b2bada4ef26109412aec019a5 (diff)
testhelper: Move temporary Gitaly socket into global test directory
The function `testhelper.GetTemporaryGitalySocketFileName()` generates a new filename which can then be used for the Gitaly socket. Currently, it's always using `/tmp` as the directory where those sockets are generated. As they typically don't get cleaned up after tests, it thus clutters that directory quite quickly. This commit instead moves them into the global temporary test directory.
Diffstat (limited to 'internal/testhelper/testhelper.go')
-rw-r--r--internal/testhelper/testhelper.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index 873991e6a..a933dbd1d 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -326,7 +326,11 @@ func FindLocalBranchResponsesEqual(a *gitalypb.FindLocalBranchResponse, b *gital
// GetTemporaryGitalySocketFileName will return a unique, useable socket file name
func GetTemporaryGitalySocketFileName() string {
- tmpfile, err := ioutil.TempFile("", "gitaly.socket.")
+ if testDirectory == "" {
+ log.Fatal("you must call testhelper.Configure() before GetTemporaryGitalySocketFileName()")
+ }
+
+ tmpfile, err := ioutil.TempFile(testDirectory, "gitaly.socket.")
if err != nil {
// No point in handling this error, panic
panic(err)