Skip to content

Commit de56be0

Browse files
committed
refactor: move docs and compose config for database tests
Those files are only realted to `tests\database` tests.
1 parent 7298238 commit de56be0

File tree

3 files changed

+47
-21
lines changed

3 files changed

+47
-21
lines changed

tests/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/databases/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Persistence Tests
2+
3+
Torrust requires Docker to run different database systems for testing.
4+
5+
Start the databases with `docker-compose` before running tests:
6+
7+
```s
8+
docker-compose -f tests/databases/docker-compose.yml up
9+
```
10+
11+
Run all tests using:
12+
13+
```s
14+
cargo test
15+
```
16+
17+
Connect to the DB using MySQL client:
18+
19+
```s
20+
mysql -h127.0.0.1 -uroot -ppassword torrust-index_test
21+
```
22+
23+
Right now only tests for MySQLite are executed. To run tests for MySQL too,
24+
you have to replace this line in `tests/databases/mysql.rs`:
25+
26+
```rust
27+
28+
```rust
29+
#[tokio::test]
30+
#[should_panic]
31+
async fn run_mysql_tests() {
32+
panic!("Todo Test Times Out!");
33+
#[allow(unreachable_code)]
34+
{
35+
run_tests(DATABASE_URL).await;
36+
}
37+
}
38+
```
39+
40+
with this:
41+
42+
```rust
43+
#[tokio::test]
44+
async fn run_mysql_tests() {
45+
run_tests(DATABASE_URL).await;
46+
}
47+
```
File renamed without changes.

0 commit comments

Comments
 (0)