mirror of
https://github.com/gofiber/storage.git
synced 2025-12-19 00:38:24 +08:00
fix: restore FIRESTORE_EMULATOR_HOST env after test
This commit is contained in:
@@ -54,6 +54,15 @@ func newTestStore(t testing.TB) *Storage {
|
||||
port, err := c.MappedPort(ctx, firestorePort)
|
||||
require.NoError(t, err)
|
||||
|
||||
originalEnv := os.Getenv("FIRESTORE_EMULATOR_HOST")
|
||||
t.Cleanup(func() {
|
||||
if originalEnv != "" {
|
||||
os.Setenv("FIRESTORE_EMULATOR_HOST", originalEnv)
|
||||
} else {
|
||||
os.Unsetenv("FIRESTORE_EMULATOR_HOST")
|
||||
}
|
||||
})
|
||||
|
||||
os.Setenv("FIRESTORE_EMULATOR_HOST", host+":"+port.Port())
|
||||
|
||||
return New(Config{
|
||||
|
||||
Reference in New Issue
Block a user