Skip to content

Commit

Permalink
refactor: move docs and compose config for database tests
Browse files Browse the repository at this point in the history
Those files are only realted to `tests\database` tests.
  • Loading branch information
josecelano committed May 8, 2023
1 parent 7298238 commit de56be0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
21 changes: 0 additions & 21 deletions tests/README.md

This file was deleted.

47 changes: 47 additions & 0 deletions tests/databases/README.md
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.

0 comments on commit de56be0

Please sign in to comment.