diff options
Diffstat (limited to 'tests/diagnostics_acceptance.rs')
| -rw-r--r-- | tests/diagnostics_acceptance.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/diagnostics_acceptance.rs b/tests/diagnostics_acceptance.rs index f1db2de..0dcba04 100644 --- a/tests/diagnostics_acceptance.rs +++ b/tests/diagnostics_acceptance.rs @@ -603,3 +603,39 @@ async fn cancelling_a_bus_diagnostic_stops_it_without_changing_proxy_intent() { .all(|entry| entry.speed_bytes_per_second.is_none()) ); } + +#[tokio::test] +async fn controller_rejects_streamed_json_errors_without_misclassifying_payload_fields() { + let mut context = Context::open().await; + for path in ["/long-error", "/late-error", "/escaped-error"] { + context.settings("/empty", path, 1, 1).await; + let error = context + .controller + .diagnostic(&Caller::root(), None, true) + .await + .unwrap_err(); + assert!( + error.to_string().contains("error document"), + "Long provider error was not recognized for {path}: {error}" + ); + } + context.settings("/empty", "/late-html", 1, 1).await; + assert!( + context + .controller + .diagnostic(&Caller::root(), None, true) + .await + .unwrap_err() + .to_string() + .contains("HTML") + ); + context.settings("/empty", "/json-data", 1, 1).await; + let observation = context + .controller + .diagnostic(&Caller::root(), None, true) + .await + .unwrap(); + assert!(observation.success); + assert!(observation.bytes > 30000); + assert_eq!(observation.stop_reason, "complete"); +} |