feat: harden community production foundation through story 1.5

This commit is contained in:
2026-08-14 00:21:59 +03:00
parent c30461cc92
commit f6fc2e5c9b
161 changed files with 16758 additions and 2515 deletions
@@ -48,7 +48,7 @@ async fn executes_rest_request_and_normalizes_json_response() {
json!({
"id": "42",
"query": "true",
"trace": "trace-123",
"trace": "",
"static": "static",
"payload": { "name": "Ada" }
})
@@ -69,6 +69,7 @@ async fn protocol_context_overrides_mapped_correlation_headers() {
"x-correlation-id".to_owned(),
"static-correlation".to_owned(),
),
("x-trace-id".to_owned(), "static-trace".to_owned()),
]),
});
let prepared = PreparedRequest {
@@ -79,12 +80,17 @@ async fn protocol_context_overrides_mapped_correlation_headers() {
"x-correlation-id".to_owned(),
"mapped-correlation".to_owned(),
),
("x-trace-id".to_owned(), "mapped-trace".to_owned()),
]),
body: Some(json!({ "name": "Ada" })),
timeout_ms: 1_000,
..PreparedRequest::default()
};
let context = RuntimeRequestContext::new("req-runtime", "corr-runtime");
let context = RuntimeRequestContext::new(
crank_core::RequestId::resolve(Some("req-runtime")),
crank_core::TraceContext::parse("00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01")
.unwrap(),
);
let response = adapter
.invoke_unary(&target, &prepared, &context)
@@ -92,7 +98,12 @@ async fn protocol_context_overrides_mapped_correlation_headers() {
.unwrap();
assert_eq!(response.body["request_id"], "req-runtime");
assert_eq!(response.body["correlation_id"], "corr-runtime");
assert_eq!(response.body["correlation_id"], "req-runtime");
assert_eq!(response.body["trace"], "0af7651916cd43dd8448eb211c80319c");
assert_eq!(
&response.body["traceparent"].as_str().unwrap()[3..35],
"0af7651916cd43dd8448eb211c80319c"
);
}
#[tokio::test(flavor = "current_thread")]