Skip to content

Commit

Permalink
testserver: respect the TMPDIR environment variable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rafiss committed Mar 10, 2023
1 parent d465a56 commit d51b7cd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions testserver/testserver.go
Expand Up @@ -455,12 +455,9 @@ func NewTestServer(opts ...TestServerOpt) (TestServer, error) {
}
}

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

mkDir := func(name string) (string, error) {
Expand Down

0 comments on commit d51b7cd

Please sign in to comment.