fix(portal-bff): set REDIS_URL + SESSION_* in auth.module.spec so ci:check passes on a clean runner #116

Merged
julien merged 1 commits from fix/portal-bff/auth-module-spec-env into main 2026-05-12 23:58:56 +02:00

1 Commits

Author SHA1 Message Date
Julien Gautier a84c4c95a5 fix(portal-bff): set REDIS_URL + SESSION_* in auth.module.spec so ci:check passes on a clean runner
CI / commits (pull_request) Successful in 1m21s
CI / scan (pull_request) Successful in 1m29s
CI / check (pull_request) Successful in 1m35s
CI / a11y (pull_request) Successful in 50s
CI / perf (pull_request) Successful in 2m18s
#115 made AuthModule import SessionModule (for AuthController to
inject UserSessionIndexService). SessionModule transitively pulls
in RedisModule whose factory calls assertRedisConfig() — that
throws when REDIS_URL is unset. auth.module.spec only seeded the
ENTRA_* env vars, so compile() blew up the moment it walked the
new import graph.

caught only by ci, not locally: nx auto-loads apps/portal-bff/.env
for tasks, which my dev box has. the ci runner starts with a clean
environment, surfaces the real failure path, and ci:check went red
on main right after #115 merged.

repro of the ci condition locally:
  env -u REDIS_URL -u SESSION_SECRET -u SESSION_ENCRYPTION_KEY \
      -u DATABASE_URL -u ENTRA_INSTANCE_URL -u ENTRA_TENANT_ID \
      -u ENTRA_CLIENT_ID -u ENTRA_CLIENT_SECRET \
      -u ENTRA_REDIRECT_URI -u ENTRA_POST_LOGOUT_REDIRECT_URI \
      pnpm exec nx test portal-bff --skip-nx-cache

fix: extend the spec's VALID env block with REDIS_URL (a
well-formed but unreachable url so ioredis stays lazy),
SESSION_SECRET, and SESSION_ENCRYPTION_KEY — same pattern as
session.module.spec.ts. and dispose the ioredis client in
afterEach so jest doesn't hang on its reconnect timer (the spec
now opens a real connection at module init).

123/123 pass under the clean-env repro. no production code change.
2026-05-12 23:50:59 +02:00