MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / response_roundtrip

Function response_roundtrip

nodedb/src/bridge/dispatch.rs:555–580  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

553
554 #[test]
555 fn response_roundtrip() {
556 let (mut dispatcher, mut data_sides) = Dispatcher::new(2, 64);
557
558 dispatcher.dispatch(make_request(0)).unwrap();
559
560 let _req = data_sides[0].request_rx.try_pop().unwrap();
561 data_sides[0]
562 .response_tx
563 .try_push(BridgeResponse {
564 inner: envelope::Response {
565 request_id: RequestId::new(1),
566 status: Status::Ok,
567 attempt: 1,
568 partial: false,
569 payload: Payload::from_vec(b"result".to_vec()),
570 watermark_lsn: Lsn::new(42),
571 error_code: None,
572 },
573 })
574 .unwrap();
575
576 let responses = dispatcher.poll_responses();
577 assert_eq!(responses.len(), 1);
578 assert_eq!(responses[0].status, Status::Ok);
579 assert_eq!(&*responses[0].payload, b"result");
580 }
581
582 #[test]
583 fn full_queue_returns_error() {

Callers

nothing calls this directly

Calls 6

try_popMethod · 0.80
try_pushMethod · 0.80
poll_responsesMethod · 0.80
make_requestFunction · 0.70
dispatchMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected