Skip to content

Commit d590028

Browse files
committed
fix(tests): update PostgreSQL connection settings in CI workflow
- Changed PostgreSQL host from 'localhost' to '127.0.0.1' for better compatibility in the GitHub Actions workflow. - Added a new step to create the database schema using a specified SQL script. - Updated environment variables for Redis and database connections to ensure consistency across the testing environment.
1 parent 6c30462 commit d590028

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,26 +181,32 @@ jobs:
181181

182182
- name: Wait for PostgreSQL
183183
run: |
184-
until pg_isready -h localhost -p 5432 -U ${{ env.DB_USER }}; do
184+
until pg_isready -h 127.0.0.1 -p 5432 -U ${{ env.DB_USER }}; do
185185
echo "Waiting for PostgreSQL..."
186186
sleep 2
187187
done
188188
189189
- name: Setup test database
190190
run: |
191-
PGPASSWORD=${{ env.DB_PASSWORD }} psql -h localhost -U ${{ env.DB_USER }} -d postgres -c "CREATE DATABASE ${{ env.DB_NAME }};" || true
191+
PGPASSWORD=${{ env.DB_PASSWORD }} psql -h 127.0.0.1 -U ${{ env.DB_USER }} -d postgres -c "CREATE DATABASE ${{ env.DB_NAME }};" || true
192+
env:
193+
PGPASSWORD: ${{ env.DB_PASSWORD }}
194+
195+
- name: Create database schema
196+
run: |
197+
PGPASSWORD=${{ env.DB_PASSWORD }} psql -h 127.0.0.1 -U ${{ env.DB_USER }} -d ${{ env.DB_NAME }} -v ON_ERROR_STOP=1 -f scripts/create_schema.sql
192198
env:
193199
PGPASSWORD: ${{ env.DB_PASSWORD }}
194200

195201
- name: Run integration tests
196202
run: npm run test:integration
197203
env:
198-
DB_HOST: localhost
204+
DB_HOST: 127.0.0.1
199205
DB_PORT: 5432
200206
DB_NAME: ${{ env.DB_NAME }}
201207
DB_USER: ${{ env.DB_USER }}
202208
DB_PASSWORD: ${{ env.DB_PASSWORD }}
203-
REDIS_HOST: localhost
209+
REDIS_HOST: 127.0.0.1
204210
REDIS_PORT: 6379
205211
NODE_ENV: test
206212

0 commit comments

Comments
 (0)