harden env handling (#481)
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #481
Co-authored-by: Simon <s.thiessen@local-it.org>
Co-committed-by: Simon <s.thiessen@local-it.org>
This commit is contained in:
Simon 2026-04-08 10:40:22 +02:00 committed by simon
parent bac488b47c
commit c48ac2f432
9 changed files with 207 additions and 55 deletions

View file

@ -4,6 +4,13 @@ System.delete_env("VEREINFACHT_API_URL")
System.delete_env("VEREINFACHT_API_KEY")
System.delete_env("VEREINFACHT_CLUB_ID")
# Mv.Config.oidc_* reads ENV before database Settings (see lib/mv/config.ex). If a developer
# or CI loads .env with OIDC variables, OidcOnlySignInRedirect and oidc_configured?/0 would
# ignore Membership settings and tests become flaky. Tests that need OIDC env (e.g. group
# claim) set it in setup and restore via on_exit.
~w(OIDC_CLIENT_ID OIDC_BASE_URL OIDC_REDIRECT_URI OIDC_CLIENT_SECRET OIDC_CLIENT_SECRET_FILE OIDC_ONLY OIDC_ADMIN_GROUP_NAME OIDC_GROUPS_CLAIM)
|> Enum.each(&System.delete_env/1)
ExUnit.start(
# shows 10 slowest tests at the end of the test run
# slowest: 10