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

[Specs][Tests] Running tests on the repo might accidentally pick up local ENV vars #21622

Open
4 tasks done
AliSoftware opened this issue Nov 8, 2023 · 0 comments
Open
4 tasks done

Comments

@AliSoftware
Copy link
Contributor

New Issue Checklist

Issue Description

Note

This is not an issue about fastlane itself — it is not preventing fastlane to run or making it crash — but an issue about the Unit Tests (aka Specs), and only when running those fastlane tests locally.

Some of our unit tests (specs) are testing cases for when an action's parameter is not provided. But if the ConfigItem being tested by that spec/test happens to have an env_name: attribute—allowing the value of that action's ConfigItem to be provided by an ENV var instead of explicitly—then running the test on a local machine might accidentally pick up environment variables from the user running the test on their machine, making the test fail or not test what it's supposed to.

So far I've encountered the case with SENTRY_AUTH_TOKEN local env var which was messing up our upload_symbols_to_sentry_spec.rb test, and I've already fixed that specific case in #21586.
But we should probably audit our tests' codebase to check if there aren't any other specs testing cases relying on the values of some ConfigItems that could be muddied by local ENV vars, and fix all of them in a similar way (aka allow(ENV).to receive(:[]).and_return(nil))

Note that this issue only affects when running the test suite on a local machine, and does not affect CI (because the environment variables set on CI machines is predictable)

Command executed

bundle exec rspec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant