Push a plan, tick, pop response, assert `Ok`.
(
core: &mut CoreLoop,
tx: &mut Producer<BridgeRequest>,
rx: &mut Consumer<BridgeResponse>,
plan: PhysicalPlan,
)
| 76 | |
| 77 | /// Push a plan, tick, pop response, assert `Ok`. |
| 78 | fn send_ok( |
| 79 | core: &mut CoreLoop, |
| 80 | tx: &mut Producer<BridgeRequest>, |
| 81 | rx: &mut Consumer<BridgeResponse>, |
| 82 | plan: PhysicalPlan, |
| 83 | ) -> Vec<u8> { |
| 84 | tx.try_push(BridgeRequest { |
| 85 | inner: make_req(plan), |
| 86 | }) |
| 87 | .unwrap(); |
| 88 | core.tick(); |
| 89 | let resp = rx.try_pop().unwrap(); |
| 90 | assert_eq!( |
| 91 | resp.inner.status, |
| 92 | Status::Ok, |
| 93 | "expected Ok status, got {:?}: {:?}", |
| 94 | resp.inner.status, |
| 95 | resp.inner.error_code |
| 96 | ); |
| 97 | resp.inner.payload.to_vec() |
| 98 | } |
| 99 | |
| 100 | /// Parse a JSON response payload into a `serde_json::Value`. |
| 101 | fn parse_json(payload: &[u8]) -> serde_json::Value { |
no test coverage detected