mirror of
https://github.com/azaion/missions.git
synced 2026-06-21 08:11:06 +00:00
Enhance test infrastructure and configuration for JWKS and Docker setup
ci/woodpecker/push/build-arm Pipeline was successful
ci/woodpecker/push/build-arm Pipeline was successful
- Updated Azaion.Missions.csproj to exclude test sources from service compilation, preventing build failures due to test project dependencies. - Modified docker-compose.test.yml to preload the pg_stat_statements extension for testing and adjusted JWT refresh intervals for better test execution timing. - Enhanced Dockerfile to install wget for health checks and ensure proper initialization of the container. - Introduced a test-only endpoint for JWKS refresh to facilitate end-to-end testing without relying on the default refresh intervals. - Updated DTOs in ApiDtos.cs to reflect camelCase naming conventions for consistency with service responses. - Improved test cases to handle JWKS rotation and refresh scenarios effectively, ensuring robust validation of JWT handling. This commit lays the groundwork for more reliable and efficient testing of the Azaion.Missions project.
This commit is contained in:
+25
-5
@@ -21,6 +21,13 @@ services:
|
||||
POSTGRES_DB: azaion
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres-test
|
||||
## FT-N-06 (AC-3.2 cascade short-circuit) inspects pg_stat_statements
|
||||
## to assert that DELETE statements against dependency tables are never
|
||||
## issued for a 404. The extension must be preloaded at server start;
|
||||
## CREATE EXTENSION alone is not enough. Production deployments would
|
||||
## leave shared_preload_libraries unset by default — this knob lives in
|
||||
## the test-only compose file.
|
||||
command: ["postgres", "-c", "shared_preload_libraries=pg_stat_statements"]
|
||||
ports:
|
||||
- "5433:5432"
|
||||
healthcheck:
|
||||
@@ -75,11 +82,24 @@ services:
|
||||
JWT_ISSUER: https://admin-test.azaion.local
|
||||
JWT_AUDIENCE: azaion-edge
|
||||
JWT_JWKS_URL: https://jwks-mock:8443/.well-known/jwks.json
|
||||
## Shorten the JWKS cache so NFT-RES-07 + NFT-SEC-11 can observe rotation
|
||||
## within the 15-minute CI wall-clock budget. Production leaves both
|
||||
## unset and inherits the library defaults (12h / 5min).
|
||||
JWT_JWKS_AUTO_REFRESH_INTERVAL_SECONDS: "30"
|
||||
JWT_JWKS_REFRESH_INTERVAL_SECONDS: "10"
|
||||
## Shorten the JWKS refresh throttle to the library minimum (1s) so
|
||||
## the test-only /test/refresh-jwks endpoint can refresh on back-to-
|
||||
## back rotation tests. ConfigurationManager.RequestRefresh() is
|
||||
## itself throttled: after the very first call, subsequent calls are
|
||||
## a no-op until (now - _lastRefresh) >= RefreshInterval. With 10s
|
||||
## throttle, two rotation tests running ~300ms apart could not both
|
||||
## force a refresh and the second one's cache would stay stale,
|
||||
## poisoning every test downstream of it. 1s leaves the rotation
|
||||
## tests pinned to their own grace-window timing (5s+) without
|
||||
## introducing artificial delays.
|
||||
##
|
||||
## JWT_JWKS_AUTO_REFRESH_INTERVAL_SECONDS is intentionally NOT set:
|
||||
## Microsoft.IdentityModel.Tokens.BaseConfigurationManager pins the
|
||||
## floor to a static 5-minute MinimumAutomaticRefreshInterval, so
|
||||
## any value below 300 throws at startup. The 12h default is fine for
|
||||
## tests because rotation observation depends on RefreshInterval +
|
||||
## /test/refresh-jwks, not the proactive auto-refresh path.
|
||||
JWT_JWKS_REFRESH_INTERVAL_SECONDS: "1"
|
||||
ASPNETCORE_URLS: http://+:8080
|
||||
ASPNETCORE_ENVIRONMENT: Test
|
||||
## CORS: Test environment (NOT Production) -- empty allow-list falls back
|
||||
|
||||
Reference in New Issue
Block a user