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

Use separate environment for every executed command #59

Merged

Conversation

andywaltlova
Copy link
Collaborator

HMS-2240

  • Change the way we set the env var from globally to local to the command
  • Write unit test to verify that the env var is not present globally
  • Look for a way to verify if the env var is set for the command executed only
    • the test verifies that same variables can be set for two different commands with different values

@codecov-commenter
Copy link

codecov-commenter commented Jul 31, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +1.41% 🎉

Comparison is base (1050628) 66.56% compared to head (0421466) 67.97%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   66.56%   67.97%   +1.41%     
==========================================
  Files           5        5              
  Lines         326      331       +5     
==========================================
+ Hits          217      225       +8     
+ Misses         93       92       -1     
+ Partials       16       14       -2     
Flag Coverage Δ
go-1.16 67.97% <100.00%> (+1.41%) ⬆️
go-1.20 67.97% <100.00%> (+1.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/runner.go 82.65% <100.00%> (+4.15%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andywaltlova andywaltlova requested a review from r0x0d July 31, 2023 11:29
@andywaltlova andywaltlova force-pushed the fix/make-env-vars-command-specific branch 3 times, most recently from 4724e9d to ed17941 Compare July 31, 2023 11:37
@andywaltlova
Copy link
Collaborator Author

andywaltlova commented Jul 31, 2023

something is not right, every other run of tests fails

SOLVED: Alright, it's not deterministic to use os.Environ() in test, the environment can change during test execution. I changed the test function to test that the environment is subset rather than exactly same.

@andywaltlova andywaltlova force-pushed the fix/make-env-vars-command-specific branch from ed17941 to 328eff9 Compare July 31, 2023 13:49
src/runner.go Outdated Show resolved Hide resolved
src/runner.go Outdated
Comment on lines 107 to 108
log.Debugln("Insights Signature:", yamlContent.Vars.InsightsSignature)
log.Debugln("Insights Signature Exclude:", yamlContent.Vars.InsightsSignatureExclude)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to remember to remove those two logs later

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed all of the debug logs now, I never used it, can be manually added anytime during local development setup anyway

src/runner.go Outdated Show resolved Hide resolved
Copy link
Member

@r0x0d r0x0d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments, but otherwise it looks good!

@andywaltlova andywaltlova force-pushed the fix/make-env-vars-command-specific branch from 328eff9 to 04da8f2 Compare August 1, 2023 05:47
@andywaltlova andywaltlova self-assigned this Aug 1, 2023
@andywaltlova andywaltlova merged commit 073659b into oamg:main Aug 3, 2023
3 checks passed
@r0x0d r0x0d mentioned this pull request Aug 10, 2023
@andywaltlova andywaltlova deleted the fix/make-env-vars-command-specific branch August 17, 2023 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants