Testing (P0-7): - 29 functional tests for order-service API (create/pay/complete/cancel lifecycle) - CustomWebApplicationFactory with InMemory DB, mocked wallet/SignalR/tenant - TestAuthHandler for JWT auth in tests - Full lifecycle tests: cash flow and online payment flow end-to-end Staging Deployment (P0-8): - K8s manifests for 8 MVP services + Redis + POS web (namespace, configmap, secrets) - Traefik Ingress with path-based routing and TLS via cert-manager - HPA auto-scaling (2-4 replicas, CPU/memory thresholds) - deploy-staging.sh script with --dry-run and --service flags - CI/CD: deploy-staging.yml and docker-build.yml with matrix strategy - Consistent patterns: port 8080, 3 health probes, RollingUpdate Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
923 B
C#
35 lines
923 B
C#
using System.Net;
|
|
using FluentAssertions;
|
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Xunit;
|
|
|
|
namespace OrderService.FunctionalTests.Controllers;
|
|
|
|
/// <summary>
|
|
/// EN: Functional tests for health check endpoints.
|
|
/// VI: Functional tests cho các endpoint kiểm tra sức khỏe.
|
|
/// </summary>
|
|
[Collection("OrderService")]
|
|
public class HealthChecksControllerTests : IClassFixture<CustomWebApplicationFactory>
|
|
{
|
|
private readonly HttpClient _client;
|
|
|
|
public HealthChecksControllerTests(CustomWebApplicationFactory factory)
|
|
{
|
|
_client = factory.CreateClient(new WebApplicationFactoryClientOptions
|
|
{
|
|
AllowAutoRedirect = false,
|
|
});
|
|
}
|
|
|
|
[Fact]
|
|
public async Task LiveHealthCheck_ShouldReturnOk()
|
|
{
|
|
// Act
|
|
var response = await _client.GetAsync("/health/live");
|
|
|
|
// Assert
|
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
|
}
|
|
}
|