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

Consolidate Unit Tests that access PATH into a single test #218

Closed
charlespierce opened this issue Dec 14, 2018 · 0 comments
Closed

Consolidate Unit Tests that access PATH into a single test #218

charlespierce opened this issue Dec 14, 2018 · 0 comments

Comments

@charlespierce
Copy link
Contributor

I ran into an issue today running cargo test, where one of the tests in notion-core/src/image/mod.rs was failing even though I hadn't made any changes to that file.

After doing a little bit of digging, it looked like what was happening was one of the tests was setting PATH at the beginning of its function, then assuming that it would always be the same value throughout. However, since the tests are run in parallel, one of the other tests was overwriting that environment variable in the middle of running itself, causing the last assertion in the first test to fail.

We can fix this by preventing the tests from running in parallel (which seems like a poor option, not taking advantage of available processing power), or by consolidating all of the tests in that module into a single test method. Then we can be sure that each line will run serially and that there won't be a race condition with the environment variables causing sporadic failures.

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