Skip to content

Commit

Permalink
chore: add ping test for api service to pre-push hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ascariandrea committed Jan 1, 2024
1 parent c25d7b9 commit cf43e36
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

docker compose up -d --remove-orphans db-test
yarn lint && yarn build && yarn vitest run

. "./scripts/ping.sh"
4 changes: 2 additions & 2 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const apiServe = {
namespace: 'liexp',
name: "api-serve",
cwd: path.resolve(__dirname, "./services/api"),
script: "./bin/run.js",
watch: ["build", "bin"],
script: "yarn start",
watch: ["build"],
watch_delay: 1000,
wait_ready: true,
listen_timeout: 10000,
Expand Down
15 changes: 15 additions & 0 deletions scripts/ping.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -ex

# start api with pm2
yarn pm2 stop all
yarn pm2 start ecosystem.config.js --only api-serve

# wait api to start
sleep 5

curl -s http://localhost:4010/v1/events


yarn pm2 stop ecosystem.config.js --only api-serve

0 comments on commit cf43e36

Please sign in to comment.