summaryrefslogtreecommitdiff
path: root/tests/diagnostics_acceptance.rs
diff options
context:
space:
mode:
authorAndrew Guschin <guschin@altlinux.org>2026-10-30 05:15:56 +0400
committerAndrew Guschin <guschin@altlinux.org>2026-10-30 05:15:56 +0400
commit3c8b130be89fbb0e58e2ee23f07ad56a3b9de2e7 (patch)
treed0e5d447f7324a2793bc6975ed57f172624d6311 /tests/diagnostics_acceptance.rs
parent7999fab25c5172207ee41e38732f4923565ff6b6 (diff)
Reject streamed diagnostic error documents and record VM qualification
Diffstat (limited to 'tests/diagnostics_acceptance.rs')
-rw-r--r--tests/diagnostics_acceptance.rs36
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");
+}