package database import "testing" // PRODUCTION MUST NOT NEED THE VARIABLE. The defaults are the production role names, so an environment that // sets nothing behaves exactly as it did before these were resolvable. A regression here would change what // production asserts, which is the one thing this change must not do. func TestDefaultsAreTheProductionRoleNames(t *testing.T) { t.Setenv("MM_APP_DB_ROLE", "") t.Setenv("MM_COMPLIANCE_DB_ROLE", "") t.Setenv("MM_AIOE_DB_ROLE", "") for _, c := range []struct { got, want string }{ {AppRoleName(), "missionmatch_app"}, {ComplianceRoleName(), "missionmatch_compliance"}, {AIOERoleName(), "missionmatch_aioe"}, } { if c.got != c.want { t.Errorf("role name = %q, want %q. Production asserts this name and sets no variable.", c.got, c.want) } } } func TestTheVariableOverrides(t *testing.T) { t.Setenv("MM_APP_DB_ROLE", "missionmatch_staging_app") if got := AppRoleName(); got != "missionmatch_staging_app" { t.Fatalf("role name = %q, want the override. Staging cannot run a single batch job without this.", got) } }