(
server: &TestServer,
tenant: u64,
bytes: Vec<u8>,
dry_run: bool,
)
| 39 | } |
| 40 | |
| 41 | async fn push_restore( |
| 42 | server: &TestServer, |
| 43 | tenant: u64, |
| 44 | bytes: Vec<u8>, |
| 45 | dry_run: bool, |
| 46 | ) -> Result<(), String> { |
| 47 | use futures::SinkExt; |
| 48 | |
| 49 | let suffix = if dry_run { " DRY RUN" } else { "" }; |
| 50 | let sink = server |
| 51 | .client |
| 52 | .copy_in::<_, Bytes>(&format!("COPY tenant_restore({tenant}) FROM STDIN{suffix}")) |
| 53 | .await |
| 54 | .map_err(detail)?; |
| 55 | let mut sink = Box::pin(sink); |
| 56 | sink.as_mut() |
| 57 | .send(Bytes::from(bytes)) |
| 58 | .await |
| 59 | .map_err(detail)?; |
| 60 | sink.as_mut().finish().await.map(|_| ()).map_err(detail) |
| 61 | } |
| 62 | |
| 63 | /// Extract the server-side error detail from a tokio_postgres error. |
| 64 | /// `e.to_string()` returns "db error"; the actual message lives on |
no test coverage detected