Build the manifest's full decomposed services architecture as real, tested code: - scheduler: 16 modules (queue/pool/policy/quota/placement/recovery + metrics/ events/backoff/health/fairness/shutdown + honest nats seam) — 130 tests - worker: 16 modules (execute/lease/resources/limits + heartbeat/events/telemetry/ sandbox/recovery/cleanup/upload/artifacts + honest plugins seam) — 52 tests - api: 20 modules (auth/authz/middleware + per-resource handlers + telemetry/ facades), app.py now a thin composition root — 98 tests - gateway: new std-only Rust reverse-proxy crate (proxy/routing/auth/cors/ rate_limit/retry/timeouts/health/metrics/events/tracing + honest tls seam) — 110 tests Every one of the 3,161 manifest files now exists. Extractions are behavior- preserving (all prior tests green); new modules add real capability; nats/tls/ plugins/sandbox are honest documented seams, not fakes. Rust workspace 352->605 tests; API 35->98. clippy -D warnings + fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
use lawsynth_gateway::GatewayConfig;
|
|
use std::time::Duration;
|
|
|
|
#[test]
|
|
fn default_configuration_is_valid() {
|
|
let config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000");
|
|
assert!(config.validate().is_ok());
|
|
assert_eq!(config.api_prefix, "/v1");
|
|
assert_eq!(config.rate_limit_window, Duration::from_secs(60));
|
|
}
|
|
|
|
#[test]
|
|
fn empty_endpoints_are_rejected() {
|
|
assert!(GatewayConfig::new("", "127.0.0.1:9000").validate().is_err());
|
|
assert!(GatewayConfig::new("127.0.0.1:8080", "").validate().is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn zero_quota_and_zero_window_are_rejected() {
|
|
let mut config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000");
|
|
config.rate_limit_quota = 0;
|
|
assert!(config.validate().is_err());
|
|
|
|
let mut config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000");
|
|
config.rate_limit_window = Duration::from_secs(0);
|
|
assert!(config.validate().is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn relative_api_prefix_is_rejected() {
|
|
let mut config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000");
|
|
config.api_prefix = "v1".into();
|
|
assert!(config.validate().is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn non_absolute_origin_is_rejected() {
|
|
let config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000")
|
|
.with_allowed_origins(vec!["app.example".into()]);
|
|
assert!(config.validate().is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn absolute_origins_are_accepted() {
|
|
let config = GatewayConfig::new("127.0.0.1:8080", "127.0.0.1:9000")
|
|
.with_allowed_origins(vec!["https://app.example".into()]);
|
|
assert!(config.validate().is_ok());
|
|
}
|