Update terminal environment variable precedence to be in line with currently xfail-ing tests
See original GitHub issueWe want environment variable resolution to behave as described in this miro board.
This behavior is described in test cases written in tests/meltano/core/test_environment_variables.py
which which currently have xfail=True
. Behavior should be updated so that these tests pass. The relevant test cases will have a comment referencing this issue.
Related:
- Exploratory issue:
- Also found:
- Xfail (expected-to-fail) tests to fix: https://github.com/meltano/meltano/commit/17ce6c65d2ea3f4b5851528ec15de45e22843be8
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
cmd - Is there a command to refresh environment variables ...
When you want to refresh the environment variables, just run resetvars.bat ... There is a command line tool named "setx" for this job....
Read more >Advanced googletest Topics
This document will show you more assertions as well as how to construct complex failure messages, propagate fatal failures, reuse and speed up...
Read more >Running tests through command-line with run-tests.sh - Drupal
Basics of how to use run-tests.sh from the command line. ... the value specified in the SYMFONY_DEPRECATIONS_HELPER environment variable, ...
Read more >GitLab CI/CD variables
Custom environment variables ... Command line Git · Feature branch workflow · Feature branch development ... Fail fast testing · Load performance testing....
Read more >Using Contexts - CircleCI
If you have existing contexts (or environment variables) and you would like to rename ... version: 2.1 workflows: my-workflow: jobs: - run-tests: context: ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tayloramurphy yes exactly, I failed to disambiguate “environment variables” from “plugin settings” since I think in practice it should be rare to pass to plugins environment variables which are not also configuration settings (or maybe it’s not rare and I’m further displaying my ignorance here 😅). The existing unit tests do test for “environment variable precedence with regard to the
env
at all levels” and that precedence behavior works as expected.@aaronsteers (CC @kgpayne--you might have also come to this conclusion or otherwise have some insight here)
After banging my head against this for a long time, I think I’ve come to the embarrassing conclusion that current behavior is in line with the spec and I misinterpreted the precedence order when writing these tests.
Basically, the currently failing tests fail because they have environment variables that are set at the terminal or active environment level and in the plugin- and/or environment-plugin level. I interpreted the precedence order in the spec to indicate that the plugin- or environment-plugin level value should “win”, but these tests fail because the values from the terminal or active environment context are “winning” and taking precedence over the plugin- and environment-plugin level values. My mistake in these tests is that the environment variables being tested are also valid settings for the mock plugin. This means that the values set for them are resolved into the plugin settings/config and then those resolved settings are mapped to environment variables, which take precedence over the plugin- and environment-plugin level envs.
The key takeaway here is that environment variables in terminal or active environment contexts will always take precedence over plugin or environment-plugin values for those same variables if those env variables in question are valid keys for a plugin setting. My reading of the spec was that plugin or environment-plugin should “win” over terminal or active environment context, but I think this was incorrect and the existing behavior is actually correct.
I think I particularly owe @kgpayne a mea culpa for potentially sending him down an unnecessary rabbit hole in trying to resolve this issue.
I’m going to update the tests to reflect my new reading of the spec and then we can finally close out this issue. FYI @tayloramurphy if you have any additional thoughts on this.