-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/44 docker setup #57
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
base: develop
Are you sure you want to change the base?
Conversation
- Modified .env.test to include test database configuration and updated server ports. - Updated .gitignore to ensure .env.test is not ignored. - Enhanced package.json with additional scripts for building, formatting, linting, and seeding test data. This commit improves the setup for testing and development workflows.
- Changed permissions of `verify-test-db-setup.sh` to make it executable. - Modified the SQL command in `verify-test-db-setup.sh` to check for the pgcrypto extension using a more precise output format. - Updated the insert statement in `verify-test-db-setup.sh` to reflect the correct column names in the contacts table. - Ensured the pgcrypto extension is created in `seed.sql` for UUID generation. These changes enhance the accuracy and reliability of the test database setup process.
Signed-off-by: Neel Mokaria <[email protected]>
| echo -e " (Runs all 80+ tests including Docker interaction)" | ||
| echo -e " 2. Run: ${YELLOW}docker compose up -d${NC}" | ||
| echo -e " (Start your test database)" | ||
| echo -e " 3. Run: ${YELLOW}npm run test${NC}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know in the issue description I used npm run test, but npm run test would actually run the tests that connect to Supabase, and so currently even with docker container running, the supabase itself is getting changed. Can we create a new test command that would specifically run the tests but make sure it uses the local test database rather than the Supabase database itself? Basically right now, it doesn't seem to be using .env.test information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted all data in current database in supabase so you can easily check if any data is getting created in there when it shouldn't anymore
soramicha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed my .env NODE_ENV to test, but when I run npm run test:local, the database in Supabase itself is changed! Also please update the PR itself if there are any changes in commands, instructions, etc.
Docker Setup and Test Database #49
Closes #49
Overview
This PR implements a comprehensive Docker-based test database setup to enable isolated testing for the volunteer management backend. The implementation provides a complete testing environment that runs independently from the production database, ensuring test isolation and repeatability.
Key Changes:
Testing
Automated Testing:
verify-test-db-setup.shwith 77 comprehensive tests across 14 phasesManual Testing:
docker compose up -d→npm run test→docker compose down -vnpm run seed:testTest Coverage:
Screenshots / Screencasts
Run
./verify-test-db-setup.sh --fullto test the docker & seed.sql related tests.Test Script Execution:
$ ./verify-test-db-setup.sh --full ======================================== FULL DATABASE ROBUSTNESS TEST (80+ tests across 14 phases) ======================================== Total Tests Run: 77 Tests Passed: 77 Tests Failed: 0 Success Rate: 100% ✅ All checks passed!Database Schema Validation:
Checklist
Notes
Files Created:
docker-compose.yml- Docker container configurationdb-init/seed.sql- Complete database schema (258 lines).env.test- Test environment configurationverify-test-db-setup.sh- Comprehensive testing script (393 lines)Files Modified:
src/config/server.ts- Application configuration.env.testwhen NODE_ENV=testpackage.json- NPM scriptsseed:testscript for manual database reseedingdocker compose exec -T test-db psql -U postgres -d test_db -f /docker-entrypoint-initdb.d/seed.sqlHow to Use:
Basic Workflow:
Verification:
Manual Reseeding:
# Reseed database without restarting container npm run seed:testComplete Test Cycle:
Key Benefits:
Technical Details:
This implementation provides a robust foundation for testing that can be easily integrated into CI/CD pipelines and used by all team members for consistent test environments.