1
0
forked from baron/baron-sso

레포 업데이트

This commit is contained in:
Lectom C Han
2026-04-01 20:32:09 +09:00
parent 8bab8d44cc
commit 4b0fbdde98
31 changed files with 1636 additions and 43 deletions

View File

@@ -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")
}
}