diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 2cad69c7..00000000 --- a/tests/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Running Tests - -Torrust requires Docker to run different database systems for testing. [Install docker here](https://docs.docker.com/engine/). - -Start the databases with `docker-compose` before running tests: - -```s -docker-compose -f tests/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 -``` diff --git a/tests/databases/README.md b/tests/databases/README.md new file mode 100644 index 00000000..54a1b842 --- /dev/null +++ b/tests/databases/README.md @@ -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; +} +``` diff --git a/tests/docker-compose.yml b/tests/databases/docker-compose.yml similarity index 100% rename from tests/docker-compose.yml rename to tests/databases/docker-compose.yml