Skip to content

Commit d058784

Browse files
authored
test: use integresql for parallel integration test capability (#432)
* test: use integresql for parallel integration test capability * fix(ci): expose port 5000 in github action for integresql * fix(test): remove logging of test database conn string * refactor(test): use execFileSync we should avoid constructing the shell command as a single string and instead use execFileSync to pass the command and its arguments separately. This approach ensures that the shell does not misinterpret any special characters in the paths or arguments.
1 parent e419cdb commit d058784

File tree

11 files changed

+869
-2039
lines changed

11 files changed

+869
-2039
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,28 @@ jobs:
4444
- install
4545
timeout-minutes: 15
4646
runs-on: ubuntu-latest
47+
services:
48+
postgres:
49+
image: postgres:latest # should be the same version as used in .github/workflows, docker-compose.test.yml, Dockerfile and live
50+
env:
51+
POSTGRES_DB: 'test'
52+
POSTGRES_USER: 'root'
53+
POSTGRES_PASSWORD: 'root'
54+
options: >-
55+
--health-cmd pg_isready
56+
--health-interval 10s
57+
--health-timeout 5s
58+
--health-retries 5
59+
ports:
60+
- 5432:5432
61+
integresql:
62+
image: ghcr.io/allaboutapps/integresql:v1.1.0
63+
env:
64+
PGHOST: 'postgres'
65+
PGUSER: 'root'
66+
PGPASSWORD: 'root'
67+
ports:
68+
- 5000:5000
4769
steps:
4870
- uses: actions/checkout@v4
4971
- uses: ./.github/actions/setup

docker-compose.test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.4'
2+
services:
3+
integresql:
4+
image: ghcr.io/allaboutapps/integresql:v1.1.0
5+
ports:
6+
- '5000:5000'
7+
depends_on:
8+
- postgres
9+
environment:
10+
PGHOST: postgres
11+
PGUSER: root
12+
PGPASSWORD: root
13+
14+
postgres:
15+
image: postgres:latest # should be the same version as used live
16+
# ATTENTION
17+
# fsync=off, synchronous_commit=off and full_page_writes=off
18+
# gives us a major speed up during local development and testing (~30%),
19+
# however you should NEVER use these settings in PRODUCTION unless
20+
# you want to have CORRUPTED data.
21+
# DO NOT COPY/PASTE THIS BLINDLY.
22+
# YOU HAVE BEEN WARNED.
23+
# Apply some performance improvements to pg as these guarantees are not needed while running locally
24+
command: "postgres -c 'shared_buffers=128MB' -c 'fsync=off' -c 'synchronous_commit=off' -c 'full_page_writes=off' -c 'max_connections=100' -c 'client_min_messages=warning'"
25+
expose:
26+
- '5432'
27+
ports:
28+
- '5432:5432'
29+
environment:
30+
POSTGRES_DB: test
31+
POSTGRES_USER: root
32+
POSTGRES_PASSWORD: root
33+
volumes:
34+
- postgres-volume:/var/lib/postgresql/data
35+
36+
volumes:
37+
postgres-volume: # declare a named volume to persist DB data

0 commit comments

Comments
 (0)