Add unit tests for Router configuration and transport layers
- 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:
118
etc/router.yaml.sample
Normal file
118
etc/router.yaml.sample
Normal file
@@ -0,0 +1,118 @@
|
||||
# StellaOps Router Configuration
|
||||
# This file configures the router gateway behavior, services, and routing rules.
|
||||
|
||||
# Payload limits control memory usage and protect against oversized requests
|
||||
payloadLimits:
|
||||
maxRequestBytesPerCall: 10485760 # 10 MB - max size of a single request
|
||||
maxRequestBytesPerConnection: 104857600 # 100 MB - max total bytes per connection
|
||||
maxAggregateInflightBytes: 1073741824 # 1 GB - max total in-flight across all connections
|
||||
|
||||
# Routing options control how requests are distributed to microservices
|
||||
routing:
|
||||
localRegion: "eu1" # This gateway's region
|
||||
neighborRegions: # Fallback regions (in order of preference)
|
||||
- eu2
|
||||
- us1
|
||||
tieBreaker: roundRobin # Options: roundRobin, random, leastLoaded, consistentHash
|
||||
preferLocalRegion: true # Prefer instances in the local region
|
||||
defaultTimeout: "00:00:30" # 30 seconds default request timeout
|
||||
|
||||
# Service definitions describe the microservices the gateway routes to
|
||||
services:
|
||||
- serviceName: billing
|
||||
defaultVersion: "1.0.0"
|
||||
defaultTransport: tcp # Options: tcp, certificate, udp, rabbitMq, inMemory
|
||||
endpoints:
|
||||
- method: POST
|
||||
path: /invoices
|
||||
defaultTimeout: "00:00:30" # 30 seconds
|
||||
supportsStreaming: false
|
||||
requiringClaims:
|
||||
- type: role
|
||||
value: billing-admin
|
||||
|
||||
- method: GET
|
||||
path: /invoices/{id}
|
||||
defaultTimeout: "00:00:05" # 5 seconds
|
||||
|
||||
- method: GET
|
||||
path: /invoices
|
||||
defaultTimeout: "00:00:10"
|
||||
supportsStreaming: true # Streaming for large result sets
|
||||
|
||||
- serviceName: inventory
|
||||
defaultVersion: "2.1.0"
|
||||
defaultTransport: certificate # TLS with client certificates
|
||||
endpoints:
|
||||
- method: GET
|
||||
path: /items
|
||||
supportsStreaming: true
|
||||
|
||||
- method: POST
|
||||
path: /items
|
||||
defaultTimeout: "00:00:15"
|
||||
requiringClaims:
|
||||
- type: role
|
||||
value: inventory-manager
|
||||
|
||||
- method: PUT
|
||||
path: /items/{id}
|
||||
defaultTimeout: "00:00:15"
|
||||
|
||||
- method: DELETE
|
||||
path: /items/{id}
|
||||
requiringClaims:
|
||||
- type: role
|
||||
value: admin
|
||||
|
||||
- serviceName: scanner
|
||||
defaultVersion: "1.0.0"
|
||||
defaultTransport: tcp
|
||||
endpoints:
|
||||
- method: POST
|
||||
path: /scan
|
||||
defaultTimeout: "00:05:00" # 5 minutes for long-running scans
|
||||
supportsStreaming: true
|
||||
|
||||
- method: GET
|
||||
path: /scan/{id}/status
|
||||
|
||||
# Static instances are pre-configured microservices (optional)
|
||||
# Usually instances are discovered dynamically via HELLO messages
|
||||
staticInstances:
|
||||
- serviceName: billing
|
||||
version: "1.0.0"
|
||||
region: eu1
|
||||
host: billing-eu1-01.internal
|
||||
port: 5100
|
||||
transport: tcp
|
||||
weight: 100
|
||||
metadata:
|
||||
environment: production
|
||||
rack: rack-1
|
||||
|
||||
- serviceName: billing
|
||||
version: "1.0.0"
|
||||
region: eu1
|
||||
host: billing-eu1-02.internal
|
||||
port: 5100
|
||||
transport: tcp
|
||||
weight: 100
|
||||
metadata:
|
||||
environment: production
|
||||
rack: rack-2
|
||||
|
||||
- serviceName: billing
|
||||
version: "1.0.0"
|
||||
region: eu2
|
||||
host: billing-eu2-01.internal
|
||||
port: 5100
|
||||
transport: tcp
|
||||
weight: 80 # Lower weight for cross-region
|
||||
metadata:
|
||||
environment: production
|
||||
|
||||
# Environment variable overrides:
|
||||
# STELLAOPS_ROUTER_PAYLOADLIMITS__MAXREQUESTBYTESPERCALL=20971520
|
||||
# STELLAOPS_ROUTER_ROUTING__DEFAULTTIMEOUT=00:01:00
|
||||
# STELLAOPS_ROUTER_ROUTING__LOCALREGION=us1
|
||||
Reference in New Issue
Block a user