Add unit tests for Router configuration and transport layers
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled

- Implemented tests for RouterConfig, RoutingOptions, StaticInstanceConfig, and RouterConfigOptions to ensure default values are set correctly.
- Added tests for RouterConfigProvider to validate configurations and ensure defaults are returned when no file is specified.
- Created tests for ConfigValidationResult to check success and error scenarios.
- Developed tests for ServiceCollectionExtensions to verify service registration for RouterConfig.
- Introduced UdpTransportTests to validate serialization, connection, request-response, and error handling in UDP transport.
- Added scripts for signing authority gaps and hashing DevPortal SDK snippets.
This commit is contained in:
StellaOps Bot
2025-12-05 08:01:47 +02:00
parent 635c70e828
commit 6a299d231f
294 changed files with 28434 additions and 1329 deletions

View File

@@ -10,3 +10,34 @@ public sealed record CancelPayload
/// </summary>
public string? Reason { get; init; }
}
/// <summary>
/// Standard reasons for request cancellation.
/// </summary>
public static class CancelReasons
{
/// <summary>
/// The HTTP client disconnected before the request completed.
/// </summary>
public const string ClientDisconnected = "ClientDisconnected";
/// <summary>
/// The request exceeded its timeout.
/// </summary>
public const string Timeout = "Timeout";
/// <summary>
/// The request or response payload exceeded configured limits.
/// </summary>
public const string PayloadLimitExceeded = "PayloadLimitExceeded";
/// <summary>
/// The gateway or microservice is shutting down.
/// </summary>
public const string Shutdown = "Shutdown";
/// <summary>
/// The transport connection was closed unexpectedly.
/// </summary>
public const string ConnectionClosed = "ConnectionClosed";
}

View File

@@ -39,4 +39,10 @@ public sealed record EndpointDescriptor
/// Gets a value indicating whether this endpoint supports streaming.
/// </summary>
public bool SupportsStreaming { get; init; }
/// <summary>
/// Gets the handler type that processes requests for this endpoint.
/// This is used by the Microservice SDK for handler resolution.
/// </summary>
public Type? HandlerType { get; init; }
}

View File

@@ -0,0 +1,27 @@
namespace StellaOps.Router.Common.Models;
/// <summary>
/// Payload for streaming data frames (REQUEST_STREAM_DATA/RESPONSE_STREAM_DATA).
/// </summary>
public sealed record StreamDataPayload
{
/// <summary>
/// Gets the correlation ID linking stream data to the original request.
/// </summary>
public required Guid CorrelationId { get; init; }
/// <summary>
/// Gets the stream data chunk.
/// </summary>
public byte[] Data { get; init; } = [];
/// <summary>
/// Gets a value indicating whether this is the final chunk.
/// </summary>
public bool EndOfStream { get; init; }
/// <summary>
/// Gets the sequence number for ordering.
/// </summary>
public int SequenceNumber { get; init; }
}

View File

@@ -0,0 +1,36 @@
namespace StellaOps.Router.Common.Models;
/// <summary>
/// Configuration options for streaming operations.
/// </summary>
public sealed record StreamingOptions
{
/// <summary>
/// Gets the default streaming options.
/// </summary>
public static readonly StreamingOptions Default = new();
/// <summary>
/// Gets the size of each chunk when streaming data.
/// Default: 64 KB.
/// </summary>
public int ChunkSize { get; init; } = 64 * 1024;
/// <summary>
/// Gets the maximum number of concurrent streams per connection.
/// Default: 100.
/// </summary>
public int MaxConcurrentStreams { get; init; } = 100;
/// <summary>
/// Gets the timeout for idle streams (no data flowing).
/// Default: 5 minutes.
/// </summary>
public TimeSpan StreamIdleTimeout { get; init; } = TimeSpan.FromMinutes(5);
/// <summary>
/// Gets the channel capacity for buffered stream data.
/// Default: 16 chunks.
/// </summary>
public int ChannelCapacity { get; init; } = 16;
}