Files
missions/tests/Azaion.Missions.E2E.Tests/Helpers/ApiDtos.cs
T
Oleksandr Bezdieniezhnykh 3398ec49a0
ci/woodpecker/push/build-arm Pipeline was successful
Enhance test infrastructure and configuration for JWKS and Docker setup
- 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.
2026-05-16 10:20:38 +03:00

57 lines
2.9 KiB
C#

using System.Text.Json.Serialization;
namespace Azaion.Missions.E2E.Helpers;
// CARRY-FORWARD (ADR-002 superseded by observed behaviour, 2026-05-15):
// The canonical spec + initial test contract pinned PascalCase wire bodies,
// but ASP.NET Core's default JsonSerializerOptions (camelCase) was never
// overridden in Program.cs. Service responses are therefore camelCase end-
// to-end. JsonPropertyName attributes match the observed wire shape so the
// tests pin actual behaviour; a future product decision to flip naming
// policy will break these tests loudly. Tracked in the traceability matrix
// under the per-test `carry_forward` traits.
public sealed record VehicleDto(
[property: JsonPropertyName("id")] Guid Id,
[property: JsonPropertyName("type")] int Type,
[property: JsonPropertyName("model")] string Model,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("fuelType")] int FuelType,
[property: JsonPropertyName("batteryCapacity")] decimal BatteryCapacity,
[property: JsonPropertyName("engineConsumption")] decimal EngineConsumption,
[property: JsonPropertyName("engineConsumptionIdle")] decimal EngineConsumptionIdle,
[property: JsonPropertyName("isDefault")] bool IsDefault);
public sealed record MissionDto(
[property: JsonPropertyName("id")] Guid Id,
[property: JsonPropertyName("createdDate")] DateTime CreatedDate,
[property: JsonPropertyName("name")] string Name,
[property: JsonPropertyName("vehicleId")] Guid VehicleId);
// Waypoint response is FLAT (lat/lon/mgrs at top level, NOT nested in a
// geoPoint object) because the SUT returns the LinqToDB entity directly via
// `Ok(waypoint)` and the entity stores those columns flat. The request DTO
// nests them under GeoPoint, but the response does not — see
// _docs/02_document/modules/controller_missions.md and Database/Entities/Waypoint.cs.
public sealed record WaypointDto(
[property: JsonPropertyName("id")] Guid Id,
[property: JsonPropertyName("missionId")] Guid MissionId,
[property: JsonPropertyName("lat")] decimal? Lat,
[property: JsonPropertyName("lon")] decimal? Lon,
[property: JsonPropertyName("mgrs")] string? Mgrs,
[property: JsonPropertyName("waypointSource")] int WaypointSource,
[property: JsonPropertyName("waypointObjective")] int WaypointObjective,
[property: JsonPropertyName("orderNum")] int OrderNum,
[property: JsonPropertyName("height")] decimal Height);
public sealed record PaginatedResponseDto<T>(
[property: JsonPropertyName("items")] List<T> Items,
[property: JsonPropertyName("totalCount")] int TotalCount,
[property: JsonPropertyName("page")] int Page,
[property: JsonPropertyName("pageSize")] int PageSize);
// Error envelope produced by ErrorHandlingMiddleware.
public sealed record ProblemDto(
[property: JsonPropertyName("statusCode")] int StatusCode,
[property: JsonPropertyName("message")] string Message);