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

Make Default Log Filter Parallel-Friendly #45

Open
goingforbrooke opened this issue Apr 2, 2024 · 4 comments
Open

Make Default Log Filter Parallel-Friendly #45

goingforbrooke opened this issue Apr 2, 2024 · 4 comments

Comments

@goingforbrooke
Copy link

Issue

Make default_log_filter stable by implementing a parallel-friendly way to manage environment variables.

Proposed Solution

The commit putting the default_log_filter attribute behind the "unstable" feature is awesome, but to get things stable, we could look to sealed-test, which solves the problem by forking unit tests into separate processes.

The shortcomings of sealed-test are that it doesn't support async and hasn't been updated in a while.

@d-e-s-o
Copy link
Owner

d-e-s-o commented Apr 3, 2024

It's certainly a possibility, but I am not really in favor of such a heavy weight approach. I am pretty sure it will come with all sorts of gotchas (e.g., from the looks of it we'd be in for platform specific logic, meaning that we may exclude some unsupported platforms outright and just generally open whatever can of worms that entails) and suddenly a crate intending to initialize some logging bits influences your test execution behavior in weird ways.

My view is that there is a path to making this functionality race-free and with that stable-friendly, and that's with global attribute support. As such, I'd think it would be best if we exert effort on this front.

@goingforbrooke
Copy link
Author

I don't like how heavyweight this approach is either, but what what other paths do you see?

@goingforbrooke
Copy link
Author

I just noticed that temp-env uses a mutex to block concurrent testing:

Note that the crate makes use of a singleton mutex to avoid side effects between concurrently running tests. This may impact the degree of concurrency in your test execution.

Losing parallel tests would be pretty sad for this library, though, since the mutex lock on RUST_LOG would make every test serial. 😢

@d-e-s-o
Copy link
Owner

d-e-s-o commented Apr 4, 2024

I don't like how heavyweight this approach is either, but what what other paths do you see?

Stable global attributes

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

2 participants