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

$BATS_MOCK_TMPDIR issue from #19 is not settled #21

Open
KlfJoat opened this issue Feb 17, 2024 · 0 comments
Open

$BATS_MOCK_TMPDIR issue from #19 is not settled #21

KlfJoat opened this issue Feb 17, 2024 · 0 comments

Comments

@KlfJoat
Copy link

KlfJoat commented Feb 17, 2024

Hi. I submitted PR #19 to use $BATS_RUN_TMPDIR for $BATS_MOCK_TMPDIR. That fixes accidentally not unstubbing. But with or without it, I realized since submitting the PR that another issue remains.

If I run a large suite of Bats tests (say, >1,000) in job parallel mode, the stubs interfere with each other and cause errors since they're all set in the run tmpdir and have no separation from each other.

I have taken to patching in $BATS_FILE_TMPDIR instead. Then at least I can disable parallelization in the individual Bats files where I use bats-mock (with export BATS_NO_PARALLELIZE_WITHIN_FILE=true) and still get parallelization across the other test files.

The other option is to set $BATS_MOCK_TMPDIR to $BATS_TEST_TMPDIR... however, that prevents people from doing a stub in the file setup() function and unstub in the file teardown() function. But it allows for parallelization within Bats test files that use bats-mock.

I prefer $BATS_FILE_TMPDIR and use sed to patch it in bc of the control I retain in the current big bash project I'm working on. But the next project might mean that I'm patching in $BATS_TEST_TMPDIR due to high bats-mock usage and need for parallelization.

There doesn't seem to be a good answer here, only a design decision to be made and documentation on the limitations/requirements. As such, I defer to you as owners.

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

No branches or pull requests

1 participant