Skip to content

Commit 251b08d

Browse files
authored
Use os.TempDir() for test socket path (#1694)
Refactor newTestMigrationContext to set ServeSocketFile via os.TempDir() and remove runtime.Caller-based path derivation.
1 parent c636347 commit 251b08d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

go/logic/test_utils.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55

66
"fmt"
7+
"os"
78
"path/filepath"
8-
"runtime"
99

1010
"github.com/github/gh-ost/go/base"
1111
"github.com/github/gh-ost/go/mysql"
@@ -68,9 +68,7 @@ func newTestMigrationContext() *base.MigrationContext {
6868
migrationContext.PanicOnWarnings = true
6969
migrationContext.AllowedRunningOnMaster = true
7070

71-
//nolint:dogsled
72-
_, filename, _, _ := runtime.Caller(0)
73-
migrationContext.ServeSocketFile = filepath.Join(filepath.Dir(filename), "../../tmp/gh-ost.sock")
71+
migrationContext.ServeSocketFile = filepath.Join(os.TempDir(), "gh-ost.sock")
7472

7573
return migrationContext
7674
}

0 commit comments

Comments
 (0)