From 282d36e9bba14698b3a0f62712200021bc24caeb Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 3 Aug 2023 12:32:45 +0200 Subject: [PATCH] test db and user creation fixed and scripted --- DEVELOPER-SETUP.md | 8 +++----- backend/romm_test/setup.sql | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 backend/romm_test/setup.sql diff --git a/DEVELOPER-SETUP.md b/DEVELOPER-SETUP.md index 81da132c8..957cc1af8 100644 --- a/DEVELOPER-SETUP.md +++ b/DEVELOPER-SETUP.md @@ -79,12 +79,10 @@ npm run dev ### Create the test database ```sh -docker exec -it mariadb mysql -u root -p -# Enter password: +docker exec -i mariadb mysql -u root -p < romm_test/setup.sql # for amd images +docker exec -i mariadb mariadb -u root -p < romm_test/setup.sql # for arm images -CREATE USER 'romm_test'@'localhost' IDENTIFIED BY 'passwd'; -CREATE DATABASE romm_test; -GRANT ALL PRIVILEGES ON romm_test.* TO 'romm_test'@'localhost' WITH GRANT OPTION; +pytest ``` Migrations will be run automatically when running the tests. diff --git a/backend/romm_test/setup.sql b/backend/romm_test/setup.sql new file mode 100644 index 000000000..b5e5f3a55 --- /dev/null +++ b/backend/romm_test/setup.sql @@ -0,0 +1,4 @@ +CREATE DATABASE romm_test; +CREATE USER 'romm_test'@'%' IDENTIFIED BY 'passwd'; +GRANT ALL PRIVILEGES ON romm_test.* TO 'romm_test'@'%' WITH GRANT OPTION; +FLUSH PRIVILEGES;