mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 10:21:14 +00:00
[AZ-372] Apply dotnet format whitespace cleanup; archive batch 22
Pure whitespace-only cleanup uncovered by the new format gate from the previous commit. Verified via `git diff -w --stat`: only 4 files differ when whitespace is ignored, and those differ only by the BOM byte. Cleanup kinds applied across 22 source files: - BOM removal (MapConfig.cs, SatTile.cs, GeoUtils.cs, IntegrationTests/Program.cs) - CRLF -> LF (IntegrationTests/Program.cs) - Trailing whitespace on blank lines (Common, Api, DataAccess, IntegrationTests, Services.RegionProcessing, Services.TileDownloader) - Final newline added (RoutePoint.cs, GeoPoint.cs, others) After this commit `dotnet format whitespace SatelliteProvider.sln --verify-no-changes` exits 0; AC-1 is enforceable from `scripts/ run-tests.sh` going forward. Also lands the batch 22 report, code-review report (PASS_WITH_WARNINGS, 2 Low findings — both deferred per spec), dependency-table status update (AZ-372 -> Done (In Testing)), task archive (todo/ -> done/), and autodev state update. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,7 +60,7 @@ public static class BasicRouteTests
|
||||
|
||||
Console.WriteLine("Retrieving route by ID...");
|
||||
var getResponse = await httpClient.GetAsync($"/api/satellite/route/{routeId}");
|
||||
|
||||
|
||||
if (!getResponse.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception($"Failed to retrieve route: {getResponse.StatusCode}");
|
||||
@@ -70,7 +70,7 @@ public static class BasicRouteTests
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
|
||||
|
||||
if (retrievedRoute == null || retrievedRoute.Id != routeId)
|
||||
{
|
||||
throw new Exception("Retrieved route does not match created route");
|
||||
|
||||
@@ -148,7 +148,7 @@ public static class ExtendedRouteTests
|
||||
using (var zipArchive = System.IO.Compression.ZipFile.OpenRead(finalRoute.TilesZipPath!))
|
||||
{
|
||||
Console.WriteLine($" ZIP contains {zipArchive.Entries.Count} files");
|
||||
|
||||
|
||||
if (zipArchive.Entries.Count == 0)
|
||||
{
|
||||
throw new Exception("ZIP file is empty");
|
||||
@@ -161,7 +161,7 @@ public static class ExtendedRouteTests
|
||||
|
||||
var firstEntry = zipArchive.Entries[0];
|
||||
Console.WriteLine($" First entry: {firstEntry.FullName} ({firstEntry.Length} bytes)");
|
||||
|
||||
|
||||
if (firstEntry.Length == 0)
|
||||
{
|
||||
throw new Exception("First entry in ZIP is empty");
|
||||
@@ -169,7 +169,7 @@ public static class ExtendedRouteTests
|
||||
|
||||
var entriesWithDirs = zipArchive.Entries.Where(e => e.FullName.Contains('/')).ToList();
|
||||
Console.WriteLine($" Entries with directory structure: {entriesWithDirs.Count}/{zipArchive.Entries.Count}");
|
||||
|
||||
|
||||
if (entriesWithDirs.Count == 0)
|
||||
{
|
||||
throw new Exception("ZIP should preserve directory structure but found no entries with paths");
|
||||
|
||||
@@ -1,118 +1,118 @@
|
||||
namespace SatelliteProvider.IntegrationTests;
|
||||
|
||||
class Program
|
||||
{
|
||||
static async Task<int> Main(string[] args)
|
||||
{
|
||||
var apiUrl = Environment.GetEnvironmentVariable("API_URL") ?? "http://api:8080";
|
||||
var modeEnv = Environment.GetEnvironmentVariable("INTEGRATION_TESTS_MODE")?.Trim().ToLowerInvariant();
|
||||
var modeArg = args.FirstOrDefault(a => a.Equals("--smoke", StringComparison.OrdinalIgnoreCase) || a.Equals("--full", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (modeArg != null)
|
||||
{
|
||||
TestRunMode.Smoke = modeArg.Equals("--smoke", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(modeEnv))
|
||||
{
|
||||
TestRunMode.Smoke = modeEnv == "smoke";
|
||||
}
|
||||
|
||||
Console.WriteLine("Starting Integration Tests");
|
||||
Console.WriteLine("=========================");
|
||||
Console.WriteLine($"API URL : {apiUrl}");
|
||||
Console.WriteLine($"Mode : {(TestRunMode.Smoke ? "smoke (fast subset, tightened timeouts)" : "full")}");
|
||||
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();
|
||||
|
||||
if (TestRunMode.Smoke)
|
||||
{
|
||||
await RunSmokeSuite(httpClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RunFullSuite(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 RunSmokeSuite(HttpClient httpClient)
|
||||
{
|
||||
await TileTests.RunGetTileByLatLonTest(httpClient);
|
||||
await RegionTests.RunRegionProcessingTest_200m_Zoom18(httpClient);
|
||||
await BasicRouteTests.RunSimpleRouteTest(httpClient);
|
||||
await ExtendedRouteTests.RunRouteWithTilesZipTest(httpClient);
|
||||
await SecurityTests.RunAll(httpClient);
|
||||
await StubAndErrorContractTests.RunAll(httpClient);
|
||||
await IdempotentPostTests.RunAll(httpClient);
|
||||
await MigrationTests.RunAll();
|
||||
}
|
||||
|
||||
static async Task RunFullSuite(HttpClient httpClient)
|
||||
{
|
||||
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);
|
||||
await StubAndErrorContractTests.RunAll(httpClient);
|
||||
await IdempotentPostTests.RunAll(httpClient);
|
||||
await MigrationTests.RunAll();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
namespace SatelliteProvider.IntegrationTests;
|
||||
|
||||
class Program
|
||||
{
|
||||
static async Task<int> Main(string[] args)
|
||||
{
|
||||
var apiUrl = Environment.GetEnvironmentVariable("API_URL") ?? "http://api:8080";
|
||||
var modeEnv = Environment.GetEnvironmentVariable("INTEGRATION_TESTS_MODE")?.Trim().ToLowerInvariant();
|
||||
var modeArg = args.FirstOrDefault(a => a.Equals("--smoke", StringComparison.OrdinalIgnoreCase) || a.Equals("--full", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (modeArg != null)
|
||||
{
|
||||
TestRunMode.Smoke = modeArg.Equals("--smoke", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(modeEnv))
|
||||
{
|
||||
TestRunMode.Smoke = modeEnv == "smoke";
|
||||
}
|
||||
|
||||
Console.WriteLine("Starting Integration Tests");
|
||||
Console.WriteLine("=========================");
|
||||
Console.WriteLine($"API URL : {apiUrl}");
|
||||
Console.WriteLine($"Mode : {(TestRunMode.Smoke ? "smoke (fast subset, tightened timeouts)" : "full")}");
|
||||
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();
|
||||
|
||||
if (TestRunMode.Smoke)
|
||||
{
|
||||
await RunSmokeSuite(httpClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
await RunFullSuite(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 RunSmokeSuite(HttpClient httpClient)
|
||||
{
|
||||
await TileTests.RunGetTileByLatLonTest(httpClient);
|
||||
await RegionTests.RunRegionProcessingTest_200m_Zoom18(httpClient);
|
||||
await BasicRouteTests.RunSimpleRouteTest(httpClient);
|
||||
await ExtendedRouteTests.RunRouteWithTilesZipTest(httpClient);
|
||||
await SecurityTests.RunAll(httpClient);
|
||||
await StubAndErrorContractTests.RunAll(httpClient);
|
||||
await IdempotentPostTests.RunAll(httpClient);
|
||||
await MigrationTests.RunAll();
|
||||
}
|
||||
|
||||
static async Task RunFullSuite(HttpClient httpClient)
|
||||
{
|
||||
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);
|
||||
await StubAndErrorContractTests.RunAll(httpClient);
|
||||
await IdempotentPostTests.RunAll(httpClient);
|
||||
await MigrationTests.RunAll();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public static class RegionTests
|
||||
};
|
||||
|
||||
var requestResponse = await httpClient.PostAsJsonAsync("/api/satellite/request", requestRegion);
|
||||
|
||||
|
||||
if (!requestResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await requestResponse.Content.ReadAsStringAsync();
|
||||
@@ -100,7 +100,7 @@ public static class RegionTests
|
||||
}
|
||||
|
||||
var initialStatus = await requestResponse.Content.ReadFromJsonAsync<RegionStatusResponse>(JsonOptions);
|
||||
|
||||
|
||||
if (initialStatus == null)
|
||||
{
|
||||
throw new Exception("No status returned from region request");
|
||||
@@ -113,13 +113,13 @@ public static class RegionTests
|
||||
Console.WriteLine("Polling for region status updates...");
|
||||
RegionStatusResponse? finalStatus = null;
|
||||
int maxAttempts = TestRunMode.RegionPollAttempts;
|
||||
|
||||
|
||||
for (int i = 0; i < maxAttempts; i++)
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
|
||||
|
||||
var statusResponse = await httpClient.GetAsync($"/api/satellite/region/{regionId}");
|
||||
|
||||
|
||||
if (!statusResponse.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await statusResponse.Content.ReadAsStringAsync();
|
||||
@@ -127,7 +127,7 @@ public static class RegionTests
|
||||
}
|
||||
|
||||
var status = await statusResponse.Content.ReadFromJsonAsync<RegionStatusResponse>(JsonOptions);
|
||||
|
||||
|
||||
if (status == null)
|
||||
{
|
||||
throw new Exception("No status returned");
|
||||
|
||||
@@ -105,12 +105,12 @@ public static class RouteTestHelpers
|
||||
public static void PrintGeneratedFiles(RouteResponseModel route, int uniqueTileCount, bool includeZip = false)
|
||||
{
|
||||
var stitchedInfo = new FileInfo(route.StitchedImagePath!);
|
||||
|
||||
|
||||
Console.WriteLine("Files Generated:");
|
||||
Console.WriteLine($" ✓ CSV: {Path.GetFileName(route.CsvFilePath)} ({uniqueTileCount} tiles)");
|
||||
Console.WriteLine($" ✓ Summary: {Path.GetFileName(route.SummaryFilePath)}");
|
||||
Console.WriteLine($" ✓ Stitched Map: {Path.GetFileName(route.StitchedImagePath)} ({stitchedInfo.Length / 1024:F2} KB)");
|
||||
|
||||
|
||||
if (includeZip && !string.IsNullOrEmpty(route.TilesZipPath))
|
||||
{
|
||||
var zipInfo = new FileInfo(route.TilesZipPath);
|
||||
@@ -125,20 +125,20 @@ public static class RouteTestHelpers
|
||||
Console.WriteLine($" Route ID: {route.Id}");
|
||||
Console.WriteLine($" Total Points: {route.TotalPoints}");
|
||||
Console.WriteLine($" Distance: {route.TotalDistanceMeters:F2}m");
|
||||
|
||||
|
||||
if (geofenceCount.HasValue)
|
||||
{
|
||||
Console.WriteLine($" Geofence Regions: {geofenceCount.Value}");
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine($" Unique Tiles: {uniqueTileCount}");
|
||||
|
||||
|
||||
if (includeZip && !string.IsNullOrEmpty(route.TilesZipPath))
|
||||
{
|
||||
var zipInfo = new FileInfo(route.TilesZipPath);
|
||||
Console.WriteLine($" ZIP File Size: {zipInfo.Length / 1024:F2} KB");
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine($" Maps Ready: {route.MapsReady}");
|
||||
Console.WriteLine();
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public static class RouteTestHelpers
|
||||
public static async Task<RouteResponseModel> CreateRoute(HttpClient httpClient, CreateRouteRequest request)
|
||||
{
|
||||
var response = await httpClient.PostAsJsonAsync("/api/satellite/route", request, JsonWriteOptions);
|
||||
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
@@ -154,7 +154,7 @@ public static class RouteTestHelpers
|
||||
}
|
||||
|
||||
var route = await response.Content.ReadFromJsonAsync<RouteResponseModel>(JsonOptions);
|
||||
|
||||
|
||||
if (route == null)
|
||||
{
|
||||
throw new Exception("No route data returned from API");
|
||||
@@ -164,24 +164,24 @@ public static class RouteTestHelpers
|
||||
}
|
||||
|
||||
public static async Task<RouteResponseModel> WaitForRouteReady(
|
||||
HttpClient httpClient,
|
||||
Guid routeId,
|
||||
int maxAttempts = 180,
|
||||
HttpClient httpClient,
|
||||
Guid routeId,
|
||||
int maxAttempts = 180,
|
||||
int pollInterval = 3000)
|
||||
{
|
||||
for (int attempt = 0; attempt < maxAttempts; attempt++)
|
||||
{
|
||||
await Task.Delay(pollInterval);
|
||||
|
||||
|
||||
var getResponse = await httpClient.GetAsync($"/api/satellite/route/{routeId}");
|
||||
|
||||
|
||||
if (!getResponse.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception($"Failed to get route status: {getResponse.StatusCode}");
|
||||
}
|
||||
|
||||
var currentRoute = await getResponse.Content.ReadFromJsonAsync<RouteResponseModel>(JsonOptions);
|
||||
|
||||
|
||||
if (currentRoute == null)
|
||||
{
|
||||
throw new Exception("No route returned");
|
||||
|
||||
@@ -22,7 +22,7 @@ public static class TileTests
|
||||
Console.WriteLine($"Getting tile at coordinates ({latitude}, {longitude}) with zoom level {zoomLevel}");
|
||||
|
||||
var response = await httpClient.GetAsync($"/api/satellite/tiles/latlon?Latitude={latitude}&Longitude={longitude}&ZoomLevel={zoomLevel}");
|
||||
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
@@ -30,7 +30,7 @@ public static class TileTests
|
||||
}
|
||||
|
||||
var tile = await response.Content.ReadFromJsonAsync<DownloadTileResponse>(JsonOptions);
|
||||
|
||||
|
||||
if (tile == null)
|
||||
{
|
||||
throw new Exception("No tile data returned from API");
|
||||
@@ -73,9 +73,9 @@ public static class TileTests
|
||||
Console.WriteLine("✓ Tile metadata validated");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Testing tile reuse (getting same tile again)...");
|
||||
|
||||
|
||||
var response2 = await httpClient.GetAsync($"/api/satellite/tiles/latlon?Latitude={latitude}&Longitude={longitude}&ZoomLevel={zoomLevel}");
|
||||
|
||||
|
||||
if (!response2.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await response2.Content.ReadAsStringAsync();
|
||||
@@ -83,7 +83,7 @@ public static class TileTests
|
||||
}
|
||||
|
||||
var tile2 = await response2.Content.ReadFromJsonAsync<DownloadTileResponse>(JsonOptions);
|
||||
|
||||
|
||||
if (tile2 == null)
|
||||
{
|
||||
throw new Exception("No tile data returned from second request");
|
||||
|
||||
Reference in New Issue
Block a user