From 37bfe278c83202eb57f07ad1baed029982627747 Mon Sep 17 00:00:00 2001 From: Josh van Leeuwen Date: Mon, 1 Apr 2024 05:29:44 +0100 Subject: [PATCH] Test Integration: hardcode binary tmp for darwin (#7664) On Darwin (MacOS), `os.TempDir()` nicely returns a truly ephemeral process directory is `/var/folders/...` however in order to reap the benefits of Go cache magic in integration tests we need a slightly more permanent directory, i.e. `/tmp`. This directory will persist across integration test runs and speed up the test execution boot times from s to ms. Signed-off-by: joshvanl --- tests/integration/framework/binary/binary.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/framework/binary/binary.go b/tests/integration/framework/binary/binary.go index 7f8c99110cf..e1626f7fc2c 100644 --- a/tests/integration/framework/binary/binary.go +++ b/tests/integration/framework/binary/binary.go @@ -60,7 +60,13 @@ func Build(t *testing.T, name string) { // Use a consistent temp dir for the binary so that the binary is cached on // subsequent runs. - binPath := filepath.Join(os.TempDir(), "dapr_integration_tests/"+name) + var tmpdir string + if runtime.GOOS == "darwin" { + tmpdir = "/tmp" + } else { + tmpdir = os.TempDir() + } + binPath := filepath.Join(tmpdir, "dapr_integration_tests/"+name) if runtime.GOOS == "windows" { binPath += ".exe" }