Skip to content

Commit

Permalink
tests: check health
Browse files Browse the repository at this point in the history
  • Loading branch information
cullenwatson committed Aug 27, 2023
1 parent dc8cded commit a6d49c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@ jobs:
curl -s http://0.0.0.0:8000/api/v1/jobs && break || sleep 1
done
- name: Check health
run: |
health_status=$(curl -L -s -o /dev/null -w "%{http_code}" http://0.0.0.0:8000/health)
if [ "$health_status" != "200" ]; then
echo "Error: Health check failed with status code $health_status"
exit 1
fi
- name: Verify results count
run: |
response=$(curl -L -s -X 'POST' -H 'Content-Type: application/json' -d '{
...
"site_type": ["indeed", "linkedin", "zip_recruiter"],
"search_term": "software engineer",
"location": "austin, tx",
"distance": 10,
"job_type": "fulltime",
"results_wanted": 5
}' http://0.0.0.0:8000/api/v1/jobs -w "%{http_code}")
status_code="${response: -3}"
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
app.include_router(api_router)


@app.get("/", tags=["health"])
@app.get("/health", tags=["health"])
async def health_check():
return {"message": "JobSpy ready to scrape"}

0 comments on commit a6d49c9

Please sign in to comment.