fix: restore FIRESTORE_EMULATOR_HOST env after test

This commit is contained in:
Yusuf Demir
2025-10-17 10:34:00 +03:00
parent aff2eba6cc
commit a8e11ac6e5

View File

@@ -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{