Skip to content

Commit

Permalink
feat: add serve command in workflow (#1204)
Browse files Browse the repository at this point in the history
* add serve command in workflow
  • Loading branch information
AkashKumar7902 committed Dec 15, 2023
1 parent 14b55e4 commit af6e468
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/node-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sudo rm -rf keploy/

for i in {1..2}; do
# Start keploy in record mode.
sudo -E env PATH=$PATH ./../../keployv2 record -c 'node src/app.js' &
sudo -E env PATH=$PATH ./../../keployv2 record -c 'npm start' &

# Wait for the application to start.
app_started=false
Expand Down Expand Up @@ -61,16 +61,22 @@ sleep 5
done

# Start keploy in test mode.
sudo -E env PATH=$PATH ./../../keployv2 test -c 'node src/app.js' --delay 10
sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10

sudo -E env PATH=$PATH ./../../keployv2 serve -c "npm test" --delay 5

# Get the test results from the testReport file.
report_file="./keploy/testReports/report-1.yaml"
test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')
report_file2="./keploy/testReports/report-2.yaml"
test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}')
report_file3="./keploy/testReports/report-3.yaml"
test_status3=$(grep 'status:' "$report_file3" | head -n 1 | awk '{print $2}')
report_file4="./keploy/testReports/report-4.yaml"
test_status4=$(grep 'status:' "$report_file4" | head -n 1 | awk '{print $2}')

# Return the exit code according to the status.
if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then
if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ] && [ "$test_status3" = "PASSED" ] && [ "$test_status4" = "PASSED" ]; then
exit 0
else
exit 1
Expand Down

0 comments on commit af6e468

Please sign in to comment.