Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarhiievHE committed Sep 15, 2023
1 parent 6e59324 commit 9a129ae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
steps:
- uses: actions/checkout@v3

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

- run: npm test

- name: Prepear docker containers for integration tests
run: |
docker-compose -f test-docker-compose.yml up -d
sleep 10 # wait for database to be ready
# - name: Prepearing api docker container for integration tests
# run: |
# docker-compose -f test-api-docker-compose.yml up -d
# sleep 2 # wait for api to be ready

- name: Client test
run: |
node server.js > /dev/null&
sleep 4 # wait for api to be ready
node test/system.js
node --test test/client.js
node --test test/system.js
24 changes: 24 additions & 0 deletions test-api-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3'

services:
api-example:
build:
context: .
dockerfile: Dockerfile
container_name: api-example
environment:
- DB_HOST=pg-example
- REDIS_HOST=redis-example
- REDIS_PORT=6379
volumes:
- ./application:/usr/server/application
ports:
- 127.0.0.1:8000:8000
- 127.0.0.1:8001:8001
- 127.0.0.1:8002:8002
restart: always

networks:
default:
name: api-example-network
external: true
20 changes: 0 additions & 20 deletions test-docker-compose.yml → test-db-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,6 @@ services:
- 127.0.0.1:6379:6379
restart: always

api-example:
build:
context: .
dockerfile: Dockerfile
container_name: api-example
environment:
- DB_HOST=pg-example
- REDIS_HOST=redis-example
- REDIS_PORT=6379
volumes:
- ./application:/usr/server/application
depends_on:
- pg-example
- redis-example
ports:
- 127.0.0.1:8000:8000
- 127.0.0.1:8001:8001
- 127.0.0.1:8002:8002
restart: always

networks:
default:
name: api-example-network

0 comments on commit 9a129ae

Please sign in to comment.