Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup test database for running tests for database #350

Merged
merged 6 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/img
/e2e/
/mysql-data
/mysql-data-test
/node_modules
/playwright-report
/test
Expand Down
20 changes: 20 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Connect to MySQL Docker container locally
DATABASE_URL="mysql://starchart:starchart_password@localhost:3307/starchart_test"

# Connect to Redis container locally
REDIS_URL=redis://localhost:6379

# Used to compute hash against the session IDs. Should be long, random.
SESSION_SECRET="super-duper-s3cret"

# https://letsencrypt.org/docs/expiration-emails/
LETS_ENCRYPT_ACCOUNT_EMAIL="[email protected]"

PORT=8080

# One of: trace, debug, info, warn, error, fatal, silent
LOG_LEVEL=debug

# Nodemailer config
NOTIFICATIONS_EMAIL_USER="[email protected]"
MAILHOG_SMTP_PORT=1025
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/build
/public/build
/mysql-data
/mysql-data-test
/redis-data
/img
/dev-secrets
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules

/redis-data
/mysql-data
/mysql-data-test
/test-results/
/playwright-report/
/playwright/.cache/
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
.env
/redis-data
/mysql-data
/mysql-data-test
/img
/playwright-report/
/dev-secrets
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ services:
MYSQL_PASSWORD: starchart_password
MYSQL_ROOT_PASSWORD: root_password

test_database:
image: mysql:8
container_name: test_database
ports:
# Only for dev to run tests in a database
- 3307:3306
volumes:
# Persist data to ./mysql-data-test. Remove if you want to clear the db.
- ./mysql-data-test:/var/lib/mysql
environment:
MYSQL_DATABASE: starchart_test
MYSQL_USER: starchart
MYSQL_PASSWORD: starchart_password
MYSQL_ROOT_PASSWORD: root_password

redis:
image: redis:7.0.8-alpine3.17
container_name: redis
Expand Down