forked from launchbadge/sqlx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* The first test thread that acquires the DO_CLEANUP permit can still run after a second test thread has already created their ephemeral test db. This will accidentally "cleanup" the currently in-use test db. Reproduce ========= Run the database containers: ```bash $ cd tests/ $ docker-compose up ``` Run the `test-db-race` tests. One test should fail. ```bash $ cd tests/ $ ./x.py -e mysql_8_tokio --test mysql-test-db-race test test_2 ... FAILED test test_1 ... ok failures: ---- test_2 stdout ---- created database _sqlx_test_database_5 thread 'test_2' panicked at 'failed to connect to test database: Database(MySqlDatabaseError { code: Some("42000"), number: 1049, message: "Unknown database '_sqlx_test_database_5'" })', /home/phlip9/dev/sqlx/sqlx-core/src/testing/mod.rs:245:10 $ ./x.py -e postgres_15_tokio --test postgres-test-db-race test test_1 ... FAILED test test_2 ... ok failures: thread 'test_1' panicked at 'failed to connect to test database: Database(PgDatabaseError { severity: Fatal, code: "3D000", message: "database \"_sqlx_test_69\" does not exist", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("postinit.c"), line: Some(941), routine: Some("InitPostgres") })', /home/phlip9/dev/sqlx/sqlx-core/src/testing/mod.rs:245:10 ```
- Loading branch information
Showing
7 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[sqlx_macros::test] | ||
async fn test_1(_pool: sqlx::MySqlPool) {} | ||
|
||
#[sqlx_macros::test] | ||
async fn test_2(_pool: sqlx::MySqlPool) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[sqlx_macros::test] | ||
async fn test_1(_pool: sqlx::PgPool) {} | ||
|
||
#[sqlx_macros::test] | ||
async fn test_2(_pool: sqlx::PgPool) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters