mirror of
https://github.com/Mic92/sops-nix.git
synced 2024-12-14 11:57:52 +00:00
use a shorter tempdir on macOS
By default macOS does something like this: /var/folders/08/j4g_jn953lngpvgmyg8dygk00000gn/T/ breaking unix socket paths of gnupg.
This commit is contained in:
parent
1279274ddc
commit
5e95616f0f
1 changed files with 10 additions and 1 deletions
|
@ -20,10 +20,19 @@ func ok(tb testing.TB, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func TempRoot() string {
|
||||
if runtime.GOOS == "darwin" {
|
||||
// macOS make its TEMPDIR long enough for unix socket to break
|
||||
return "/tmp"
|
||||
} else {
|
||||
return os.TempDir()
|
||||
}
|
||||
}
|
||||
|
||||
func TestCli(t *testing.T) {
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
assets := path.Join(path.Dir(filename), "test-assets")
|
||||
tempdir, err := ioutil.TempDir("/tmp", "testdir")
|
||||
tempdir, err := ioutil.TempDir(TempRoot(), "testdir")
|
||||
ok(t, err)
|
||||
defer os.RemoveAll(tempdir)
|
||||
|
||||
|
|
Loading…
Reference in a new issue