Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Integration: hardcode binary tmp for darwin #7664

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

JoshVanL
Copy link
Contributor

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 when re-building binaries between integration test runs 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.

Updates integration test binary builder to use/tmp as the root dir when running on darwin.

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 <me@joshvanl.dev>
@JoshVanL JoshVanL requested review from a team as code owners March 31, 2024 01:28
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.84%. Comparing base (892acfb) to head (608a11a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7664      +/-   ##
==========================================
- Coverage   61.87%   61.84%   -0.04%     
==========================================
  Files         245      245              
  Lines       22418    22418              
==========================================
- Hits        13872    13865       -7     
- Misses       7385     7391       +6     
- Partials     1161     1162       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if runtime.GOOS == "darwin" {
tmpdir = "/tmp"
} else {
tmpdir = os.TempDir()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a design issue for Go os package? Maybe we can submit an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think Go is doing the more correct thing here as a sane default, however because we want a slightly more persistent target directory we need to divert from the default.

Copy link
Member

@daixiang0 daixiang0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaron2 yaron2 merged commit 37bfe27 into dapr:master Apr 1, 2024
20 of 22 checks passed
cicoyle pushed a commit to cicoyle/dapr that referenced this pull request May 24, 2024
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 <me@joshvanl.dev>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
elena-kolevska pushed a commit to elena-kolevska/dapr that referenced this pull request Jun 10, 2024
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 <me@joshvanl.dev>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants