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
Refactor to k6 lookupEnv and abstract env. var. lookup #918
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inancgumus
force-pushed
the
refactor/822-k6-lookupenv
branch
4 times, most recently
from
June 1, 2023 14:55
0c67592
to
36943a9
Compare
inancgumus
changed the title
Refactor/822 k6 lookupenv
Refactor to k6 lookupEnv and abstract env. var. lookup
Jun 1, 2023
inancgumus
force-pushed
the
refactor/822-k6-lookupenv
branch
3 times, most recently
from
June 2, 2023 11:28
3fd6c8d
to
59f6bef
Compare
This will be refactored in later commits to use k6.LookupEnv.
This will stop the whole test run and it's important because with a panic only a single test will panic. However, this is a globally needed functionality and the whole test run should abort.
This helps to get default behavior in tests and prevent nil pointer errors.
Without this tests that depend on LookupEnv will fail with a nil pointer error. Tests that want to set this can do so.
inancgumus
force-pushed
the
refactor/822-k6-lookupenv
branch
from
June 2, 2023 11:47
59f6bef
to
f8e4cb4
Compare
The test needed a fix too as we're getting env. vars. from VU now.
Since we will use InitEnv().LookupEnv, add support for that in the test browser. Any test want to test with an environment variable can use withLookupFunc to set an environment variable.
The previous commit unlocked using this now.
Switch to withLookupFunc in testBrowser. We're now setting environment variables via InitEnv(). So we no longer need this method.
Tests can provide explicit values if necessary by providing a lookupfunc to the testBrowser.
This test wasn't running since we switched to environment variable browser options. These changes need to be made along with other browser options as you can see in the change because the commit would fail otherwise.
Just a little refactor for ordering expected fields to improve clarity.
Document the options for the test types.
inancgumus
force-pushed
the
refactor/822-k6-lookupenv
branch
from
June 2, 2023 12:00
f8e4cb4
to
6ffa156
Compare
ankur22
approved these changes
Jun 2, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🙂
ka3de
approved these changes
Jun 6, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @inancgumus ! 👏 Made a couple of comments, but overall LGTM.
We can revert this commit if this is needed. Resolves: #918 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the direct usage of
os.LookupEnv
to k6LookupEnv
. Please have a look at the commit descriptions for the changes needed.These new changes provide enhanced testability and consistency throughout the module.
The following are all the environment variables and options that the k6-browser module supports. The outdated
XK6_*
are removed and aligned with the new browser options we have.