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

Getwd() breaks test caching on build runners like Buildkite #1355

Closed
kevinburke opened this issue Feb 8, 2024 · 1 comment · Fixed by #1357
Closed

Getwd() breaks test caching on build runners like Buildkite #1355

kevinburke opened this issue Feb 8, 2024 · 1 comment · Fixed by #1357

Comments

@kevinburke
Copy link
Contributor

I work on a project that has a test suite that calls ginkgo.RunSpecs. RunSpecs calls os.Getwd() in order to set the SuitePath, which is used mainly for cosmetic purposes - the display in the default reporter.

Unfortunately os.Getwd() calls os.Getenv("PWD"), which can change from run to run if you are using a test suite runner like e.g. Buildkite. Because test caching relies on environment variables being the same from run to run, this facile change breaks test caching.

It would be great if there was an option to disable the os.Getwd() call, so we can preserve test caching, otherwise we may try to pivot away from using this library altogether.

kevinburke added a commit to kevinburke/ginkgo that referenced this issue Feb 8, 2024
This breaks test caching; see
onsi#1355 for details.
@onsi
Copy link
Owner

onsi commented Feb 8, 2024

hey there - happy to add this, perhaps configured via the presence of an environment variable like GINKGO_PRESERVE_CACHE=TRUE or some-such. I see you've already started a fork to validate getting rid of that os.Getcwd() call would be sufficient? Would you be up for adding a guard based on that environment variable and validating that you get the behavior you want?

kevinburke added a commit to kevinburke/ginkgo that referenced this issue Feb 8, 2024
os.Getwd() calls os.Getenv("PWD"), which can change from run to run if
you are using a test suite runner like e.g. Buildkite. Because test
caching relies on environment variables being the same from run to
run, this facile change breaks test caching.

Fixes onsi#1355.
onsi pushed a commit that referenced this issue Feb 12, 2024
os.Getwd() calls os.Getenv("PWD"), which can change from run to run if
you are using a test suite runner like e.g. Buildkite. Because test
caching relies on environment variables being the same from run to
run, this facile change breaks test caching.

Fixes #1355.
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 a pull request may close this issue.

2 participants