Skip to content

Commit

Permalink
Embrace testcontainers for tests (#15)
Browse files Browse the repository at this point in the history
* Achieve testcontainers testing

* Update CI workflow
  • Loading branch information
cowuake authored Oct 22, 2024
1 parent ee41512 commit 5ee247a
Show file tree
Hide file tree
Showing 29 changed files with 1,074 additions and 95 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ APP_HOST_PORT=3042
APP_CONTAINER_PORT=3000
APP_PORT=3000

MONGO_IMAGE=mongo:8
MONGO_CONTAINER_NAME=fastLazyBee-mongo
MONGO_DB_NAME=sample_mflix
MONGO_HOST_PORT=27027
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
sleep 1
done
- name: Run basic tests
- name: Run basic test (workshop scenario)
run: |
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" ${{ env.TEST_ENDPOINT }})
if [ $RESPONSE_CODE -eq 200 ]; then
Expand All @@ -50,6 +50,10 @@ jobs:
exit 1
fi
- name: Tear down Docker Compose
run: |
docker-compose -f docker-compose.yml down
- name: Run unit/integration tests
run: |
npm ci
Expand All @@ -60,7 +64,3 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info

- name: Tear down Docker Compose
run: |
docker-compose -f docker-compose.yml down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"sourceMaps": true,
"env": {
"NODE_ENV": "development"
"NODE_ENV": "test"
}
}
]
Expand Down
Loading

0 comments on commit 5ee247a

Please sign in to comment.