Skip to content

Commit d51b7cd

Browse files
committed
testserver: respect the TMPDIR environment variable
This will be useful for cockroachdb CI, which has logic that can preserve temporary files in TMPDIR in the CI artifacts. It's safe to remove the logic to use "/tmp" since that was initially added in a2ed1c6, but it's no longer needed since the testserver no longer creates UNIX sockets.
1 parent d465a56 commit d51b7cd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

testserver/testserver.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,9 @@ func NewTestServer(opts ...TestServerOpt) (TestServer, error) {
455455
}
456456
}
457457

458-
// Force "/tmp/" so avoid OSX's really long temp directory names
459-
// which get us over the socket filename length limit.
460-
baseDir, err := os.MkdirTemp("/tmp", "cockroach-testserver")
458+
baseDir, err := os.MkdirTemp("", "cockroach-testserver")
461459
if err != nil {
462-
return nil, fmt.Errorf("%s: could not create temp directory: %w",
463-
testserverMessagePrefix, err)
460+
return nil, fmt.Errorf("%s: could not create temp directory: %w", testserverMessagePrefix, err)
464461
}
465462

466463
mkDir := func(name string) (string, error) {

0 commit comments

Comments
 (0)