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

🐛 prevent testutils from loading local providers #3040

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

arlimus
Copy link
Member

@arlimus arlimus commented Jan 17, 2024

Testutils are meant as an in-memory testing utility for unit tests. However, in their default configuration they pull providers from the local system, which can have unforseen consequences.

Most of the code in testutils.go already sets up the runtime to use in-memory providers with linked dependencies.

This changes ensures that we don't accidentally load installed providers on the system - or try to install online providers. For unit tests, we rely on providers that are fast to grab and execute, thus executable from memory. Other types of testing (particularly smoke/integration) are a different matter and not in scope of these utilities at the time of writing. (Which doesn't mean that they can't become that, but I think we want to be more explicit about when that happens, to avoid accidental side-effects where unit tests start to install providers)

Counter-points to this are very welcome!

Testutils are meant as an in-memory testing utility for unit tests.
However, in their default configuration they pull providers from the
local system, which can have unforseen consequences.

Most of the code in `testutils.go` already sets up the runtime to use
in-memory providers with linked dependencies.

This changes ensures that we don't accidentally load installed providers
on the system - or try to install online providers. For unit tests, we
rely on providers that are fast to grab and execute, thus executable
from memory. Other types of testing (particularly smoke/integration) are
a different matter and not in scope of these utilities at the time of
writing. (Which doesn't mean that they can't become that, but I think we
want to be more explicit about when that happens, to avoid accidental
side-effects where unit tests start to install providers)

Counter-points to this are very welcome!

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
@arlimus arlimus merged commit 511d35f into main Jan 17, 2024
10 checks passed
@arlimus arlimus deleted the dom/testutils-noupdate branch January 17, 2024 08:48
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants