aboutsummaryrefslogtreecommitdiffstats
path: root/internal/bolttest/env.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/bolttest/env.go')
-rw-r--r--internal/bolttest/env.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/bolttest/env.go b/internal/bolttest/env.go
new file mode 100644
index 0000000..8f0ad63
--- /dev/null
+++ b/internal/bolttest/env.go
@@ -0,0 +1,19 @@
+package bolttest
+
+import (
+ "os"
+ "testing"
+
+ "github.com/eugenetriguba/checkmate/assert"
+)
+
+func UnsetEnv(t *testing.T, key string) {
+ originalVal, isSet := os.LookupEnv(key)
+ if isSet {
+ t.Cleanup(func() {
+ err := os.Setenv(key, originalVal)
+ assert.Nil(t, err)
+ })
+ os.Unsetenv(key)
+ }
+}