첫 커밋: 로컬 프로젝트 업로드
This commit is contained in:
commit
6a8dbeb2e9
1211 files changed
+312864
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsProductionEnv_StageIsProductionLike(t *testing.T) {
|
||||
t.Setenv("APP_ENV", "stage")
|
||||
t.Setenv("GO_ENV", "")
|
||||
|
||||
if !IsProductionEnv() {
|
||||
t.Fatalf("expected stage to be treated as production-like")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsDryRunAllowed_DisabledInStage(t *testing.T) {
|
||||
t.Setenv("APP_ENV", "stage")
|
||||
t.Setenv("GO_ENV", "")
|
||||
|
||||
if IsDryRunAllowed() {
|
||||
t.Fatalf("expected dry-run to be disabled in stage")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsProductionEnv_FallsBackToGoEnv(t *testing.T) {
|
||||
originalAppEnv, hadAppEnv := os.LookupEnv("APP_ENV")
|
||||
if hadAppEnv {
|
||||
t.Cleanup(func() {
|
||||
_ = os.Setenv("APP_ENV", originalAppEnv)
|
||||
})
|
||||
} else {
|
||||
t.Cleanup(func() {
|
||||
_ = os.Unsetenv("APP_ENV")
|
||||
})
|
||||
}
|
||||
_ = os.Unsetenv("APP_ENV")
|
||||
t.Setenv("GO_ENV", "production")
|
||||
|
||||
if !IsProductionEnv() {
|
||||
t.Fatalf("expected GO_ENV=production fallback to be production-like")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user