mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-26 07:21:13 +00:00
[AZ-1074] [AZ-1075] gRPC tile stream tests and shared proto
Extract tile_provision.proto into GrpcContracts, add integration tests and validation hardening for DeliverRouteTiles streaming. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,6 +15,28 @@ namespace SatelliteProvider.Tests;
|
||||
|
||||
public class RouteTileDeliveryOrchestratorTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task DeliverAsync_InvalidLatitude_Throws()
|
||||
{
|
||||
var expander = new RouteTileExpander(
|
||||
new RoutePointGraphBuilder(Options.Create(new ProcessingConfig { MaxRoutePointSpacingMeters = 200 })),
|
||||
new GeofenceGridCalculator());
|
||||
var orchestrator = CreateOrchestrator(expander, Mock.Of<ITileRepository>(), Mock.Of<ITileService>());
|
||||
var job = new RouteTileDeliveryJob(
|
||||
Guid.NewGuid(),
|
||||
[(91.0, 37.0), (47.0, 37.0)],
|
||||
400,
|
||||
18,
|
||||
[],
|
||||
false,
|
||||
[]);
|
||||
|
||||
var act = () => orchestrator.DeliverAsync(job, new RecordingSink(), CancellationToken.None);
|
||||
|
||||
await act.Should().ThrowAsync<ArgumentException>()
|
||||
.WithMessage("*lat must be between -90 and 90*");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeliverAsync_AllTilesSkippedByClient_EmitsManifestAndCompleteWithZeroDelivered()
|
||||
{
|
||||
@@ -160,6 +182,21 @@ public class RouteTileDeliveryOrchestratorTests
|
||||
}
|
||||
}
|
||||
|
||||
private static RouteTileDeliveryOrchestrator CreateOrchestrator(
|
||||
RouteTileExpander expander,
|
||||
ITileRepository tileRepo,
|
||||
ITileService tileService)
|
||||
{
|
||||
return new RouteTileDeliveryOrchestrator(
|
||||
expander,
|
||||
tileRepo,
|
||||
tileService,
|
||||
Options.Create(new MapConfig { TileSizePixels = 256, AllowedZoomLevels = [18] }),
|
||||
Options.Create(new ProcessingConfig { MaxConcurrentDownloads = 2 }),
|
||||
Options.Create(new TileProvisionConfig { MaxTilesPerBatch = 100 }),
|
||||
NullLogger<RouteTileDeliveryOrchestrator>.Instance);
|
||||
}
|
||||
|
||||
private sealed class RecordingSink : IRouteTileDeliverySink
|
||||
{
|
||||
public (uint Total, uint Skipped, uint ToDeliver)? Manifest { get; private set; }
|
||||
|
||||
Reference in New Issue
Block a user