envvar_test TestConfiguration_Get questions #80
-
Thanks for this example and the supporting blog posts and videos -- its great and I really appreciate these resources you're providing. I have a couple very minor questions about envvar_test.go. The tests seems to use fixture data here which raises the following questions:
As it is, the code seems slightly inconsistent and its unclear if the intention is to use/rely on the fixtures data or not. Perhaps it would be clearer to either:
What do you think? (It also seems the return value from loading the fixtures data is ignored... for my experiments, i was missing the fixtures data but i didn't realize it for a while 😅) It may be clearer to just eliminate the use of fixture data for the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hello @wcwynn! So the answer to all your 3 questions: when creating tests that involve leaving some sort of state I like restoring that to the original system value; however you're right I should have used With that being said, I'm glad you reached out because what I did right here does not make sense anymore if Go 1.17 is being used, so I updated the code to use the new Best! |
Beta Was this translation helpful? Give feedback.
Hello @wcwynn!
So the answer to all your 3 questions: when creating tests that involve leaving some sort of state I like restoring that to the original system value; however you're right I should have used
os.LookupEnv
instead.With that being said, I'm glad you reached out because what I did right here does not make sense anymore if Go 1.17 is being used, so I updated the code to use the new
t.Setenv
method, take a look when you have some free time, I think it's cleaner this way.Best!