caelum0x bd58228c14 feat: complete manifest services layer — decomposed modules + Rust gateway
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>
2026-08-17 19:55:26 +03:00

48 lines
1.6 KiB
Rust

//! Integration tests for [`SchedulerConfig`] validation and defaults.
use std::time::Duration;
use lawsynth_scheduler::{SchedulerConfig, SchedulerError};
#[test]
fn accepts_a_valid_configuration() {
let config = SchedulerConfig::new(8, 2, Duration::from_millis(50), 8192).unwrap();
assert_eq!(config.maximum_queued_jobs, 8);
assert_eq!(config.maximum_attempts, 2);
assert_eq!(config.lease_duration, Duration::from_millis(50));
assert_eq!(config.maximum_checkpoint_bytes, 8192);
}
#[test]
fn default_is_a_valid_configuration() {
let default = SchedulerConfig::default();
assert_eq!(default.maximum_queued_jobs, 10_000);
assert_eq!(default.maximum_attempts, 3);
assert_eq!(default.lease_duration, Duration::from_secs(30));
assert_eq!(default.maximum_checkpoint_bytes, 16 * 1024);
}
#[test]
fn rejects_zero_queue_capacity() {
let error = SchedulerConfig::new(0, 2, Duration::from_millis(50), 8192).unwrap_err();
assert!(matches!(error, SchedulerError::InvalidConfig(_)));
}
#[test]
fn rejects_zero_attempts() {
let error = SchedulerConfig::new(8, 0, Duration::from_millis(50), 8192).unwrap_err();
assert!(matches!(error, SchedulerError::InvalidConfig(_)));
}
#[test]
fn rejects_zero_lease_duration() {
let error = SchedulerConfig::new(8, 2, Duration::ZERO, 8192).unwrap_err();
assert!(matches!(error, SchedulerError::InvalidConfig(_)));
}
#[test]
fn rejects_a_checkpoint_ceiling_below_five_kib() {
let error = SchedulerConfig::new(8, 2, Duration::from_millis(50), 1024).unwrap_err();
assert!(matches!(error, SchedulerError::InvalidConfig(_)));
}