()
| 15 | |
| 16 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 17 | async fn tokio_postgres_extended_query_works() -> Result<()> { |
| 18 | let server = PgliteServer::temporary_tcp()?; |
| 19 | let (client, connection) = tokio_postgres::connect(&server.connection_uri(), NoTls) |
| 20 | .await |
| 21 | .context("connect with tokio-postgres")?; |
| 22 | let connection_task = tokio::spawn(connection); |
| 23 | |
| 24 | let row = client |
| 25 | .query_one("SELECT $1::int4 + 1 AS answer", &[&41_i32]) |
| 26 | .await |
| 27 | .context("run tokio-postgres parameter query")?; |
| 28 | assert_eq!(row.get::<_, i32>("answer"), 42); |
| 29 | |
| 30 | client |
| 31 | .batch_execute( |
| 32 | "CREATE TABLE items(value TEXT); |
| 33 | INSERT INTO items(value) VALUES ('alpha');", |
| 34 | ) |
| 35 | .await?; |
| 36 | let row = client |
| 37 | .query_one("SELECT value FROM items WHERE value = $1", &[&"alpha"]) |
| 38 | .await |
| 39 | .context("run tokio-postgres table query")?; |
| 40 | assert_eq!(row.get::<_, &str>(0), "alpha"); |
| 41 | |
| 42 | drop(client); |
| 43 | wait_for_tokio_postgres(connection_task).await?; |
| 44 | server.shutdown()?; |
| 45 | Ok(()) |
| 46 | } |
| 47 | |
| 48 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 49 | async fn tokio_postgres_extended_query_errors_recover_after_sync() -> Result<()> { |
nothing calls this directly
no test coverage detected