Files
satellite-provider/SatelliteProvider.IntegrationTests/Program.cs
T
Oleksandr Bezdieniezhnykh 7822841587 [AZ-289] [AZ-290] Batch 3 tests: integration ZIP cap, perf, security, queue
AZ-289 — RL-01 50MB ZIP cap added to RunRouteWithTilesZipTest;
existing integration tests already cover BT-08/BT-09 + AC-1/AC-2.

AZ-290:
- scripts/run-performance-tests.sh extended with PT-01/03/04/05
- SatelliteProvider.IntegrationTests/SecurityTests.cs (SEC-01..SEC-04),
  wired into Program.cs
- SatelliteProvider.Tests/RegionRequestQueueTests.cs covering RS-04 /
  RL-02 queue capacity behavior

Notes:
- RS-04 spec wording ("rejects overflow") drifts from the channel's
  BoundedChannelFullMode.Wait back-pressure semantics. Tests assert
  the actual behavior; spec to be reconciled in Step 12 (Test-Spec
  Sync). Tracked as Low/Spec-Gap in batch_03_review.md.
- Unit tests: 35/35 passed (Docker .NET 8 SDK).
- Integration test project builds clean (0 warnings, 0 errors).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-10 05:10:30 +03:00

85 lines
2.8 KiB
C#

namespace SatelliteProvider.IntegrationTests;
class Program
{
static async Task<int> Main(string[] args)
{
var apiUrl = Environment.GetEnvironmentVariable("API_URL") ?? "http://api:8080";
Console.WriteLine("Starting Integration Tests");
Console.WriteLine("=========================");
Console.WriteLine($"API URL: {apiUrl}");
Console.WriteLine();
using var httpClient = new HttpClient
{
BaseAddress = new Uri(apiUrl),
Timeout = TimeSpan.FromMinutes(15)
};
try
{
Console.WriteLine("Waiting for API to be ready...");
await WaitForApiReady(httpClient);
Console.WriteLine("✓ API is ready");
Console.WriteLine();
await TileTests.RunGetTileByLatLonTest(httpClient);
await RegionTests.RunRegionProcessingTest_200m_Zoom18(httpClient);
await RegionTests.RunRegionProcessingTest_400m_Zoom17(httpClient);
await RegionTests.RunRegionProcessingTest_500m_Zoom18(httpClient);
await BasicRouteTests.RunSimpleRouteTest(httpClient);
await BasicRouteTests.RunRouteWithRegionProcessingAndStitching(httpClient);
await ExtendedRouteTests.RunRouteWithTilesZipTest(httpClient);
await ComplexRouteTests.RunComplexRouteWithStitching(httpClient);
await ComplexRouteTests.RunComplexRouteWithStitchingAndGeofences(httpClient);
await ExtendedRouteTests.RunExtendedRouteEast(httpClient);
await SecurityTests.RunAll(httpClient);
Console.WriteLine();
Console.WriteLine("=========================");
Console.WriteLine("All tests completed successfully!");
return 0;
}
catch (Exception ex)
{
Console.WriteLine();
Console.WriteLine("❌ Integration tests failed");
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Stack trace: {ex.StackTrace}");
return 1;
}
}
static async Task WaitForApiReady(HttpClient httpClient, int maxRetries = 30)
{
for (int i = 0; i < maxRetries; i++)
{
try
{
var response = await httpClient.GetAsync("/");
if (response.IsSuccessStatusCode || response.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return;
}
}
catch
{
}
Console.WriteLine($" Attempt {i + 1}/{maxRetries} - waiting 2 seconds...");
await Task.Delay(2000);
}
throw new Exception("API did not become ready in time");
}
}