Skip to content

Commit 44364c7

Browse files
committed
update test
1 parent 6e59324 commit 44364c7

File tree

3 files changed

+36
-25
lines changed

3 files changed

+36
-25
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323

24+
- name: Start db docker containers
25+
run: |
26+
docker-compose -f test-db-docker-compose.yml up -d
27+
sleep 10 # wait for database to be ready
28+
2429
- name: Use Node.js ${{ matrix.node }}
2530
uses: actions/setup-node@v3
2631
with:
@@ -37,12 +42,14 @@ jobs:
3742

3843
- run: npm test
3944

40-
- name: Prepear docker containers for integration tests
41-
run: |
42-
docker-compose -f test-docker-compose.yml up -d
43-
sleep 10 # wait for database to be ready
45+
# - name: Prepearing api docker container for integration tests
46+
# run: |
47+
# docker-compose -f test-api-docker-compose.yml up -d
48+
# sleep 2 # wait for api to be ready
4449

4550
- name: Client test
4651
run: |
52+
node server.js&
53+
sleep 2 # wait for api to be ready
54+
node test/system.js
4755
node --test test/client.js
48-
node --test test/system.js

test-api-docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3'
2+
3+
services:
4+
api-example:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: api-example
9+
environment:
10+
- DB_HOST=pg-example
11+
- REDIS_HOST=redis-example
12+
- REDIS_PORT=6379
13+
volumes:
14+
- ./application:/usr/server/application
15+
ports:
16+
- 127.0.0.1:8000:8000
17+
- 127.0.0.1:8001:8001
18+
- 127.0.0.1:8002:8002
19+
restart: always
20+
21+
networks:
22+
default:
23+
name: api-example-network
24+
external: true

test-docker-compose.yml renamed to test-db-docker-compose.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,6 @@ services:
2222
- 127.0.0.1:6379:6379
2323
restart: always
2424

25-
api-example:
26-
build:
27-
context: .
28-
dockerfile: Dockerfile
29-
container_name: api-example
30-
environment:
31-
- DB_HOST=pg-example
32-
- REDIS_HOST=redis-example
33-
- REDIS_PORT=6379
34-
volumes:
35-
- ./application:/usr/server/application
36-
depends_on:
37-
- pg-example
38-
- redis-example
39-
ports:
40-
- 127.0.0.1:8000:8000
41-
- 127.0.0.1:8001:8001
42-
- 127.0.0.1:8002:8002
43-
restart: always
44-
4525
networks:
4626
default:
4727
name: api-example-network

0 commit comments

Comments
 (0)