Skip to content

feat(config): add support for separate test database via .env.test #1629

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EmiFunes91
Copy link

@EmiFunes91 EmiFunes91 commented May 18, 2025

Summary

This PR adds support for a dedicated PostgreSQL test database by introducing a .env.test file and adapting the config logic to switch automatically based on the ENVIRONMENT variable.

What’s in this PR

  • Adds a .env.test file with ENVIRONMENT=test and POSTGRES_DB=app_test
  • Updates config.py to dynamically load the correct database
  • Documents the workflow under a new Testing Environment section in the README

Why

Right now, both development and test environments point to the same DB (app), which can lead to data conflicts during CI runs or local testing.

This solves Issue #125 by making test isolation simple and configuration-driven—no breaking changes introduced.

Additional Notes

  • The same Docker Compose setup is used for dev and test
  • .env.test is included by default — let me know if you’d prefer it excluded via .gitignore
  • This keeps compatibility with all current workflows while making CI cleaner and safer

@EmiFunes91
Copy link
Author

Hi maintainers!

The check-labels workflow is currently failing because it requires one of the following labels:
breaking, security, feature, bug, refactor, upgrade, docs, lang-all, or internal.

Could you please add one of them? I believe feature would be appropriate in this case.

Thank you very much!

@EmiFunes91 EmiFunes91 force-pushed the fix/separate-test-dev-db branch from b3f8eb1 to d4469b9 Compare May 18, 2025 05:07
@EmiFunes91 EmiFunes91 force-pushed the fix/separate-test-dev-db branch from d4469b9 to f95084d Compare May 18, 2025 05:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant