From e001815a18ba2939a2844fcb33013de9f71dc3e6 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Mon, 8 Jun 2020 00:18:53 -0700 Subject: [PATCH] test: fix non-repeatable postgres macro test --- tests/postgres/macros.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/postgres/macros.rs b/tests/postgres/macros.rs index 37d5019a..5026fe9f 100644 --- a/tests/postgres/macros.rs +++ b/tests/postgres/macros.rs @@ -1,4 +1,4 @@ -use sqlx::Postgres; +use sqlx::{Connection, Postgres}; use sqlx_test::new; use futures::TryStreamExt; @@ -22,10 +22,11 @@ async fn test_query() -> anyhow::Result<()> { #[sqlx_macros::test] async fn test_no_result() -> anyhow::Result<()> { let mut conn = new::().await?; + let mut tx = conn.begin().await?; - let _ = sqlx::query!("DELETE FROM pg_enum") - .execute(&mut conn) - .await?; + let _ = sqlx::query!("DELETE FROM tweet").execute(&mut tx).await?; + + // let the transaction rollback so we don't actually delete the tweets Ok(()) } @@ -62,7 +63,7 @@ async fn test_text_var_char_char_n() -> anyhow::Result<()> { } #[sqlx_macros::test] -async fn _file() -> anyhow::Result<()> { +async fn test_query_file() -> anyhow::Result<()> { let mut conn = new::().await?; // keep trailing comma as a test