| | |
| | | EventCallbackDispatch, deliver_event_callback_with, project_worker_stdout_event, |
| | | run_event_callback_worker, |
| | | }; |
| | | use crate::controlled_fixture_probe_event; |
| | | use crate::{ |
| | | CONTROLLED_FIXTURE_GENERATION, CONTROLLED_FIXTURE_PROBE_TTL, |
| | | ControlledFixtureVisibilityEvidence, PendingControlledFixtureProbe, |
| | | controlled_fixture_probe_event, controlled_fixture_visibility_event, |
| | | }; |
| | | use anyhow::Result; |
| | | use serde_json::{Value, json}; |
| | | use std::{cell::RefCell, rc::Rc, sync::mpsc}; |
| | |
| | | ] { |
| | | assert!(project_worker_stdout_event(call_id, &invalid.to_string()).is_none()); |
| | | } |
| | | |
| | | let received_at = std::time::Instant::now(); |
| | | let visibility = controlled_fixture_visibility_event( |
| | | call_id, |
| | | runtime_trace_id, |
| | | &PendingControlledFixtureProbe { |
| | | sender: livekit::prelude::ParticipantIdentity("user-1".to_string()), |
| | | call_id_hash: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| | | .to_string(), |
| | | call_trace_id_hash: trace_hash.to_string(), |
| | | generation: CONTROLLED_FIXTURE_GENERATION, |
| | | sequence: "fixture-01".to_string(), |
| | | received_at, |
| | | expires_at: received_at + CONTROLLED_FIXTURE_PROBE_TTL, |
| | | }, |
| | | &ControlledFixtureVisibilityEvidence { |
| | | first_visible_bucket: "250_500ms", |
| | | visibility_source: "participant_attributes_poll", |
| | | binding_matched: true, |
| | | }, |
| | | ); |
| | | let projected = project_worker_stdout_event(call_id, &visibility.to_string()) |
| | | .expect("post-expiry evidence must enter the production stdout projection"); |
| | | assert_eq!(projected["extension"]["first_visible_bucket"], "250_500ms"); |
| | | assert_eq!(projected["extension"]["binding_matched"], true); |
| | | } |
| | | |
| | | #[test] |