Skip to content

Commit

Permalink
Integration test (#28)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Integrated a new health check endpoint that queries the PostgreSQL
database for views.
- Introduced integration testing with Docker-compose environment setup
for better reliability.
- Added new scripts for integration testing in the development
environment.
- **Bug Fixes**
- Updated health check commands for `frontend` and `backend` services to
improve service monitoring.
- **Documentation**
- Updated comments to clarify the use of middleware and categorize
dependencies.
- **Tests**
- Expanded test coverage to include health checks, GraphQL endpoint
functionality, and ping functionality.
- **Chores**
- Enhanced ESLint configuration to include additional test and
configuration files.
- Modified Docker-compose configurations for improved service
definitions and health checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
csikb committed Apr 7, 2024
1 parent 89bbc17 commit c5a021c
Show file tree
Hide file tree
Showing 15 changed files with 1,174 additions and 13 deletions.
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ orbs:
docker: circleci/docker@2.6.0
codecov: codecov/codecov@4.0.1
github-cli: circleci/github-cli@2.3.0
executors:
node-machine:
machine:
image: ubuntu-2204:edge
docker_layer_caching: true
defaults:
docker_publish: &docker_publish
image: bsstudio/bss-web-graphql-backend
Expand All @@ -30,6 +35,17 @@ jobs:
flags: unit
- store_artifacts:
path: reports
integration-test:
executor: node-machine
steps:
- checkout
- node/install-packages
- run:
command: npm run test:int:ci
environemnt:
- DEBUG: testcontainers:compose
- store_test_results:
path: reports
github_release:
docker:
- image: cimg/base:stable
Expand All @@ -50,6 +66,8 @@ workflows:
name: Unit test
run-command: test:ci
test-results-path: reports
- integration-test:
name: Integration test
- coverage:
name: Coverage
- node/run:
Expand Down
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
{
"files": [
"tests/**/*.test.ts",
"vitest.config.ts"
"testsInt/**/*.test.ts",
"vitest.config.ts",
"vitest.int.config.ts"
],
"parserOptions": {
"project": "tsconfig.test.json"
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
graphql:
ports: ["3000"]
backend:
ports: ["8080"]
db:
ports: ["5432"]
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ services:
depends_on:
- backend
healthcheck:
test: ""
test: "wget --tries=1 --no-verbose -qO- http://localhost:3000/actuator/health | grep -q UP"
start_period: 5s
interval: 30s
interval: 10s
timeout: 5s
retries: 3
# once db is initialized, we can shut down the container
Expand All @@ -22,10 +22,10 @@ services:
image: ghcr.io/bsstudio/bss-web-admin-backend:v1.8.0
healthcheck:
test: "wget --tries=1 --no-verbose -qO- http://localhost:8080/actuator/health | grep -q UP"
start_period: 5s
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
depends_on:
- db
environment:
Expand All @@ -39,7 +39,7 @@ services:
db:
image: "postgres:16.2-alpine3.18"
ports:
- "1111:5432"
- "127.0.0.1:5432:5432"
environment:
POSTGRES_DB: "bss"
POSTGRES_USER: "user"
Expand Down
Loading

0 comments on commit c5a021c

Please sign in to comment.