Skip to content

Commit

Permalink
test: use DROP ... WITH (FORCE) in tests (#108)
Browse files Browse the repository at this point in the history
Postgres tests very frequently fail because supposedly there's a session
still running when dropping the test database (which doesn't make much
sense, because closing the only session and THEN dropping the database
should be done sequentially in a single future).

Single this is becoming increasingly annoying and I don't have any good
idea how to fix this properly, and this is only affecting tests, I think
it's fine to just do `WITH (FORCE)` and forget about the issue for now.
  • Loading branch information
m4tx authored Jan 23, 2025
1 parent d8d91f4 commit 2be5248
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cot/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ impl TestDatabase {
TestDatabaseKind::Postgres { db_url, db_name } => {
let database = Database::new(format!("{db_url}/postgres")).await?;

database.raw(&format!("DROP DATABASE {db_name}")).await?;
database
.raw(&format!("DROP DATABASE {db_name} WITH (FORCE)"))
.await?;
database.close().await?;
}
TestDatabaseKind::MySql { db_url, db_name } => {
Expand Down

0 comments on commit 2be5248

Please sign in to comment.