I have a Go application where application reads environment variables when booting up. The application configures itself using the values of the environment variables.
Now, depending on one of the env variable's value, application gets setup differently than other value of same env variable.
I want to test both these setups in my unit tests. I also want to run these tests in parallel.
I can set env variable value using os.Setenv() in one test but that will also impact another test running in parallel that tries to set a different value for this same env variable.
What is the best practice in such cases? And how can we set env variables values that do not impact across unit tests.