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 4 commits
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
33 changes: 33 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Connect to MySQL Docker container locally
# NOTE: this value is also mirrored in dev-secrets/DATABASE_URL.
# We set it here for Prisma scripts to work, which expect it
# in the env, but at runtime we read it as a secret in docker swarm.
DATABASE_URL="mysql://root:[email protected]:3306/starchart_test"

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

# Let's encrypt directory URL (the server we request the cert from)
# Staging: 'https://acme-staging-v02.api.letsencrypt.org/directory'
# Production 'https://acme-v02.api.letsencrypt.org/directory'
# Local development / testing docker container 'https://127.0.0.1:14000/dir'
LETS_ENCRYPT_DIRECTORY_URL="https://127.0.0.1:14000/dir"

# 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

# Notifications Email Config
NOTIFICATIONS_EMAIL_USER="[email protected]"
SMTP_PORT=1025

# SSO Config
HOSTNAME=http://localhost:8080
# The SimpleSAML IDP's XML metadata
SAML_IDP_METADATA_PATH=config/idp-metadata-dev.xml
# Our apps's SP Entity ID, which is also the URL to our metadata.
SAML_ENTITY_ID=http://host.docker.internal:8080/sp
6 changes: 6 additions & 0 deletions config/01-databases.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- create regular and test databases
CREATE DATABASE IF NOT EXISTS `starchart_test`;

-- create root user and grant rights
CREATE USER 'root'@'localhost' IDENTIFIED BY 'root_password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
volumes:
# Persist data to ./mysql-data. Remove if you want to clear the db.
- ./mysql-data:/var/lib/mysql
# Locate SQL file to setup test database
- ./config/01-databases.sql:/docker-entrypoint-initdb.d/init/01-databases.sql
environment:
MYSQL_DATABASE: starchart
MYSQL_USER: starchart
Expand Down