Skip to content

Commit fdfae24

Browse files
committed
fix(coprocessor): restore truncate
1 parent bd5e074 commit fdfae24

File tree

1 file changed

+22
-0
lines changed
  • coprocessor/fhevm-engine/transaction-sender/tests

1 file changed

+22
-0
lines changed

coprocessor/fhevm-engine/transaction-sender/tests/common.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ impl TestEnvironment {
8888
.connect(db_instance.db_url())
8989
.await?;
9090

91+
Self::truncate_tables(
92+
&db_pool,
93+
vec![
94+
"verify_proofs",
95+
"ciphertext_digest",
96+
"allowed_handles",
97+
"delegate_user_decrypt",
98+
"keys",
99+
"crs",
100+
"host_chains",
101+
],
102+
)
103+
.await?;
104+
91105
let anvil = Self::new_anvil()?;
92106
let chain_id =
93107
get_chain_id(anvil.ws_endpoint_url(), std::time::Duration::from_secs(1)).await;
@@ -167,4 +181,12 @@ impl TestEnvironment {
167181
fn new_anvil_with_port(port: u16) -> anyhow::Result<AnvilInstance> {
168182
Ok(Anvil::new().block_time(1).port(port).try_spawn()?)
169183
}
184+
185+
async fn truncate_tables(db_pool: &sqlx::PgPool, tables: Vec<&str>) -> Result<(), sqlx::Error> {
186+
for table in tables {
187+
let query = format!("TRUNCATE {}", table);
188+
sqlx::query(&query).execute(db_pool).await?;
189+
}
190+
Ok(())
191+
}
170192
}

0 commit comments

Comments
 (0)