Created
July 30, 2020 10:00
-
-
Save royge/2e133c58609c524dc83739b49ce5efaf to your computer and use it in GitHub Desktop.
Check required environment variables in running tests.
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
package checkenv | |
import ( | |
"os" | |
"testing" | |
) | |
func CheckEnvs(t *testing.T, envs ...string) { | |
t.Helper() | |
for _, env := range envs { | |
if v := os.Getenv(env); v == "" { | |
t.Fatalf("environment variable `%s` is not defined", env) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment