lawsynth/services/gateway/tests/tracing_test.rs
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

33 lines
916 B
Rust

use lawsynth_gateway::tracing::{RequestIds, request_log_line};
#[test]
fn request_ids_are_deterministic_and_monotonic() {
let ids = RequestIds::new();
assert_eq!(ids.next_id(), "req-0000000000000001");
assert_eq!(ids.next_id(), "req-0000000000000002");
assert_eq!(ids.next_id(), "req-0000000000000003");
}
#[test]
fn request_ids_are_unique_across_the_generator() {
let ids = RequestIds::new();
let first = ids.next_id();
let second = ids.next_id();
assert_ne!(first, second);
}
#[test]
fn log_line_is_structured_and_complete() {
let line = request_log_line("req-42", "POST", "/v1/runs", 201, "10.0.0.5", 2048);
for fragment in [
"request_id=req-42",
"method=POST",
"path=/v1/runs",
"status=201",
"client=10.0.0.5",
"duration_us=2048",
] {
assert!(line.contains(fragment), "missing {fragment} in {line}");
}
}