-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for environment variables #110
Merged
SamirTalwar
merged 8 commits into
SamirTalwar:main
from
rradczewski:feature/add-envvars
May 25, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2c7a196
Add support for environment variables
rradczewski afd2d60
Use compose
rradczewski 32ac82d
chore: Add tests and fix merging environment, not replacing it
rradczewski 819dfbf
Use ruby script to print env variables (works around win vs. linux sh…
rradczewski b55659c
Allow suite-level definition of environment
rradczewski 6d852d8
Add documentation
rradczewski 040a25e
Shorter merging suite-level an test-level environment
rradczewski 3b8865d
dot.
SamirTalwar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ARGV.each { |arg| puts ENV[arg] } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
command: | ||
- ruby | ||
- fixtures/environment.rb | ||
|
||
environment: | ||
ONLY_DEFINED_IN_FIXTURE_DEFAULT: "defined_in_fixture_default" | ||
OVERWRITTEN_IN_FIXTURE_FROM_DEFAULT: "not_overwritten" | ||
|
||
tests: | ||
- name: environment | ||
environment: | ||
TEST_ENV: "test-value" | ||
args: | ||
- TEST_ENV | ||
stdout: | | ||
test-value | ||
|
||
- name: inherits | ||
args: | ||
- ONLY_DEFINED_IN_SPEC | ||
- ONLY_DEFINED_IN_FIXTURE_DEFAULT | ||
stdout: | | ||
defined_in_spec | ||
defined_in_fixture_default | ||
|
||
- name: overwrites | ||
environment: | ||
OVERWRITE_IN_FIXTURE: "overwritten" | ||
args: | ||
- OVERWRITE_IN_FIXTURE | ||
stdout: | | ||
overwritten | ||
|
||
- name: overwrites-from-default | ||
environment: | ||
OVERWRITTEN_IN_FIXTURE_FROM_DEFAULT: "overwritten" | ||
args: | ||
- OVERWRITTEN_IN_FIXTURE_FROM_DEFAULT | ||
stdout: | | ||
overwritten | ||
|
||
- name: not-defined | ||
args: | ||
- NOT_DEFINED | ||
stdout: "\n" | ||
|
||
- name: spec-is-merged-into-fixture-not-replaced | ||
environment: | ||
OVERWRITE_IN_FIXTURE: "overwritten" | ||
args: | ||
- OVERWRITE_IN_FIXTURE | ||
- ONLY_DEFINED_IN_SPEC | ||
- ONLY_DEFINED_IN_FIXTURE_DEFAULT | ||
stdout: | | ||
overwritten | ||
defined_in_spec | ||
defined_in_fixture_default |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests: | ||
- name: environment | ||
args: | ||
- fixtures/environment/smoke.yaml | ||
exit-code: 0 | ||
environment: | ||
OVERWRITE_IN_FIXTURE: "not_overwritten" | ||
ONLY_DEFINED_IN_SPEC: "defined_in_spec" | ||
stdout: | ||
- file: io/environment.out |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
environment | ||
succeeded | ||
inherits | ||
succeeded | ||
overwrites | ||
succeeded | ||
overwrites-from-default | ||
succeeded | ||
not-defined | ||
succeeded | ||
spec-is-merged-into-fixture-not-replaced | ||
succeeded | ||
|
||
6 tests, 0 failures |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
I've added this to generalize retrieving env variables between operating systems. Alternatively, we could have each of the tests echo both, e.g.
echo $TEST_ENV %TEST_ENV%
and assert on either of them being substituted. LMKThere 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.
I think this is solid. It might be worth adding tests for Windows in the future if we find it to be strange in some way but I don't expect it's necessary.