As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit c0bbf759 authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Move global tempDir into StartSocketHttpServer()

parent 74d3b483
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -17,11 +17,6 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/testhelper"
)
var (
tempDir, _ = os.MkdirTemp("", "gitlab-shell-test-api")
testSocket = path.Join(tempDir, "internal.sock")
)
type TestRequestHandler struct {
Path string
Handler func(w http.ResponseWriter, r *http.Request)
Loading
Loading
@@ -30,9 +25,12 @@ type TestRequestHandler struct {
func StartSocketHttpServer(t *testing.T, handlers []TestRequestHandler) string {
t.Helper()
tempDir, _ := os.MkdirTemp("", "gitlab-shell-test-api")
t.Cleanup(func() { os.RemoveAll(tempDir) })
testSocket := path.Join(tempDir, "internal.sock")
err := os.MkdirAll(filepath.Dir(testSocket), 0700)
require.NoError(t, err)
t.Cleanup(func() { os.RemoveAll(tempDir) })
socketListener, err := net.Listen("unix", testSocket)
require.NoError(t, err)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment