Integration Tests Against a Real Database
The integration tests of billing-service (job integration in /home/student/repos/billing-service/.github/workflows/ci.yml) need a PostgreSQL database. Today they fail because nothing is listening on localhost:5432.
Give the integration job a service container named postgres that:
postgres:17,POSTGRES_USER=app, POSTGRES_PASSWORD=app and POSTGRES_DB=app_test,5432 on the runner as 5432,pg_isready (so the job waits until the database accepts connections).The test step gets DATABASE_URL=postgres://app:app@localhost:5432/app_test as an environment variable.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of CI/CD Pipelines in Practice. Next step: One Test Workflow Called by Two
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.