-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move docs and compose config for database tests
Those files are only realted to `tests\database` tests.
- Loading branch information
1 parent
7298238
commit de56be0
Showing
3 changed files
with
47 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
# Persistence Tests | ||
|
||
Torrust requires Docker to run different database systems for testing. | ||
|
||
Start the databases with `docker-compose` before running tests: | ||
|
||
```s | ||
docker-compose -f tests/databases/docker-compose.yml up | ||
``` | ||
|
||
Run all tests using: | ||
|
||
```s | ||
cargo test | ||
``` | ||
|
||
Connect to the DB using MySQL client: | ||
|
||
```s | ||
mysql -h127.0.0.1 -uroot -ppassword torrust-index_test | ||
``` | ||
|
||
Right now only tests for MySQLite are executed. To run tests for MySQL too, | ||
you have to replace this line in `tests/databases/mysql.rs`: | ||
|
||
```rust | ||
|
||
```rust | ||
#[tokio::test] | ||
#[should_panic] | ||
async fn run_mysql_tests() { | ||
panic!("Todo Test Times Out!"); | ||
#[allow(unreachable_code)] | ||
{ | ||
run_tests(DATABASE_URL).await; | ||
} | ||
} | ||
``` | ||
|
||
with this: | ||
|
||
```rust | ||
#[tokio::test] | ||
async fn run_mysql_tests() { | ||
run_tests(DATABASE_URL).await; | ||
} | ||
``` |
File renamed without changes.