mirror of
https://github.com/azaion/missions.git
synced 2026-06-22 13:41:07 +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:
@@ -0,0 +1,111 @@
|
||||
# Baseline Metrics — `02-baseline-cleanup`
|
||||
|
||||
**Date**: 2026-05-16
|
||||
**Mode**: automatic
|
||||
**Scope**: missions service production code (post-rename `Azaion.Missions.*`, net10.0)
|
||||
**Inputs**: `architecture_compliance_baseline.md` (2026-05-14 PASS_WITH_WARNINGS) + `implementation_report_tests.md` (Step 6 outcomes) + Step 7 test results (`test-results/report.csv`)
|
||||
|
||||
## Goals
|
||||
|
||||
Address the residual Maintainability findings the architecture-baseline scan surfaced, now that the missions/vehicles rename and the test cycle have landed.
|
||||
|
||||
| Source | Original finding | Status today |
|
||||
|--------|------------------|--------------|
|
||||
| F1 (High Architecture) | `Database/Entities/Aircraft.cs` imports feature-component enums | **Resolved 2026-05-14** by doc retag — enums re-owned by `04_persistence` |
|
||||
| F2 (High Architecture) | `Database/Entities/Waypoint.cs` imports feature-component enums | **Resolved 2026-05-14** by same doc retag |
|
||||
| F3 (Low Maintainability) | Dead `using Azaion.Flights.Enums;` in `Database/Entities/Flight.cs` | **Resolved by rename** — `Mission.cs` has no such using; verified |
|
||||
| F4 (Low Maintainability) | Three empty scaffolding dirs at repo root | **Partial**: `Infrastructure/` is now populated (2 files); `Entities/` and `DTOs/Requests/` remain empty |
|
||||
|
||||
**Net actionable scope for this run**: 2 empty directories (`Entities/`, `DTOs/Requests/`).
|
||||
|
||||
## Coverage
|
||||
|
||||
| Suite | Tests | Pass | Fail | Skip | Source |
|
||||
|-------|-------|------|------|------|--------|
|
||||
| E2E (functional + NFT) | 78 | 48 | 0 | 30 | `test-results/report.csv` (2026-05-15 14:03 UTC) |
|
||||
| Unit | 0 | – | – | – | No unit-test project today (`scripts/run-tests.sh --unit-only` is a no-op) |
|
||||
|
||||
All 30 skips are environment-mismatch (`COMPOSE_RESTART_ENABLED!=1` and/or `MissionsContainerHelper.Enabled=false` — the e2e-consumer image deliberately lacks docker-CLI primitives). Each carries an explicit `Skip` reason. AC trace coverage (per implementation report): 56/56 ACs traced.
|
||||
|
||||
Line coverage / branch coverage: not measured. The project does not configure `coverlet` or any other coverage collector. **N/A — out of scope for this run.**
|
||||
|
||||
## Complexity
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Production `.cs` files (excl. `bin/`, `obj/`, `tests/`, `_docs/`) | 37 |
|
||||
| Production LOC (incl. blank lines & comments) | 1,306 |
|
||||
| Avg LOC per production file | 35.3 |
|
||||
| Largest 5 files (LOC) | `Services/VehicleService.cs` 134 · `Program.cs` 120 · `Database/DatabaseMigrator.cs` 119 · `Auth/JwtExtensions.cs` 112 · `Services/MissionService.cs` 107 |
|
||||
| Test LOC (excl. `bin/`, `obj/`) | 6,511 |
|
||||
|
||||
Cyclomatic complexity: not measured. No Roslyn analyzer (`dotnet format analyzers`, `Roslynator`, `SonarAnalyzer.CSharp`) is configured. **N/A — measurement infrastructure absent; out of scope.**
|
||||
|
||||
Note on size: 1,306 LOC across 37 files (avg 35 LOC/file, max 134) is well within the simplicity envelope this codebase aims for. There are no hot files calling out for decomposition.
|
||||
|
||||
## Code Smells
|
||||
|
||||
From `architecture_compliance_baseline.md` only (no static analyzer configured):
|
||||
|
||||
| Severity | Count | Open today |
|
||||
|----------|-------|------------|
|
||||
| Critical | 0 | 0 |
|
||||
| High (Architecture) | 2 (F1, F2) | 0 — resolved 2026-05-14 |
|
||||
| Low (Maintainability) | 2 (F3, F4) | 1 partial (F4: 2 of 3 empty dirs remain); F3 resolved by rename |
|
||||
|
||||
## Performance
|
||||
|
||||
Per `test-results/report.csv` 2026-05-15 14:03, the 4 NFT-PERF tests (`PerformanceTests.NFT_PERF_01..04`) all passed against thresholds defined in `_docs/02_document/tests/performance-tests.md`. Per-scenario p50/p95/p99 captured by the test harness.
|
||||
|
||||
This refactor run does not target performance — **N/A as a baseline-vs-final gate.**
|
||||
|
||||
## Dependencies
|
||||
|
||||
`Azaion.Missions.csproj` (Sdk.Web, net10.0):
|
||||
|
||||
| Package | Version |
|
||||
|---------|---------|
|
||||
| linq2db | 6.2.0 |
|
||||
| Microsoft.AspNetCore.Authentication.JwtBearer | 10.0.5 |
|
||||
| Npgsql | 10.0.2 |
|
||||
| Swashbuckle.AspNetCore | 10.1.5 |
|
||||
|
||||
Outdated / vulnerable: not measured (would require `dotnet list package --outdated --vulnerable` against a configured NuGet source). Out of scope for this run.
|
||||
|
||||
## Build
|
||||
|
||||
| Metric | Value | Source |
|
||||
|--------|-------|--------|
|
||||
| Test suite wall-clock (last successful run) | ~ minutes (Docker compose up + 78 tests) | `test-results/results.trx` mtime 2026-05-15 14:03 |
|
||||
| Docker build (cold, prior failed run) | ~42 min ended in CS0246 | terminal log `451778.txt` |
|
||||
| Docker build (after csproj `Compile Remove="tests/**"` fix) | known-good per prior session | implicit from the green `report.csv` |
|
||||
|
||||
## Functionality Inventory
|
||||
|
||||
Components and ownership (from `_docs/02_document/module-layout.md` § Per-Component Mapping, post-rename):
|
||||
|
||||
| # | Component | Owns | Routes | Tests |
|
||||
|---|-----------|------|--------|-------|
|
||||
| 01 | vehicle_catalog | `DTOs/*Vehicle*`, `Database/Entities/Vehicle.cs`, `Enums/{VehicleType,FuelType}.cs`, `Controllers/VehiclesController.cs`, `Services/VehicleService.cs` | `/vehicles`, `/vehicles/{id}/default` | FT-P-01..06, FT-N-01..04, NFT-RES-08 |
|
||||
| 02 | mission_planning | `DTOs/*Mission*`, `Database/Entities/Mission.cs`, `Controllers/MissionsController.cs`, `Services/MissionService.cs` | `/missions` | FT-P-07..12, FT-N-05..06, NFT-RES-01 |
|
||||
| 04 | persistence | `Database/{AppDataConnection,DatabaseMigrator}.cs`, all `Database/Entities/*.cs` (excl. domain), `Enums/{ObjectStatus,WaypointSource,WaypointObjective}.cs` | – | NFT-RES-03..04 |
|
||||
| 05 | authentication | `Auth/JwtExtensions.cs`, JWT-bearer config in `Program.cs` | – | NFT-SEC-* (14 ACs) |
|
||||
| 06 | infrastructure | `Infrastructure/{ConfigurationResolver,CorsConfigurationValidator}.cs`, `Middleware/ErrorHandlingMiddleware.cs`, `Program.cs` composition | `/health`, `/swagger` | FT-P-13..18, NFT-SEC-13 (CORS), NFT-RES-05..07 |
|
||||
|
||||
Empty scaffolding directories (no component owns them): `Entities/`, `DTOs/Requests/`.
|
||||
|
||||
## Self-verification
|
||||
|
||||
- [x] RUN_DIR created with correct auto-incremented prefix (`02-baseline-cleanup`)
|
||||
- [x] Coverage measured (E2E only; unit + line coverage marked N/A with reason)
|
||||
- [x] Complexity measured (file count, LOC, top-5; cyclomatic marked N/A with reason)
|
||||
- [x] Code smells measured (from baseline scan; static analyzer N/A)
|
||||
- [x] Performance noted (perf tests green; not a baseline-vs-final gate)
|
||||
- [x] Dependencies enumerated (outdated/vulnerable scan N/A)
|
||||
- [x] Build noted (test wall-clock + Docker build status)
|
||||
- [x] Functionality inventory complete (6 components + 2 empty dirs)
|
||||
- [x] Measurements reproducible (commands inline in this file or sourced from named artifacts)
|
||||
|
||||
## Scope warning for the user (BLOCKING)
|
||||
|
||||
The actionable surface is **two empty directories**. Everything else the original baseline scan flagged is already resolved (F1/F2 by doc retag, F3 by rename, F4 partial). Running the full 8-phase refactor for this is heavyweight; quick-assessment (phases 0–2 only) is plausible. See the BLOCKING choice block presented to the user.
|
||||
Reference in New Issue
Block a user