mirror of https://github.com/Bunsly/JobSpy
tests: check health
parent
dc8cded39f
commit
a6d49c9016
|
@ -30,10 +30,24 @@ jobs:
|
||||||
curl -s http://0.0.0.0:8000/api/v1/jobs && break || sleep 1
|
curl -s http://0.0.0.0:8000/api/v1/jobs && break || sleep 1
|
||||||
done
|
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
|
- name: Verify results count
|
||||||
run: |
|
run: |
|
||||||
response=$(curl -L -s -X 'POST' -H 'Content-Type: application/json' -d '{
|
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}")
|
}' http://0.0.0.0:8000/api/v1/jobs -w "%{http_code}")
|
||||||
|
|
||||||
status_code="${response: -3}"
|
status_code="${response: -3}"
|
||||||
|
|
2
main.py
2
main.py
|
@ -11,6 +11,6 @@ app = FastAPI(
|
||||||
app.include_router(api_router)
|
app.include_router(api_router)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/", tags=["health"])
|
@app.get("/health", tags=["health"])
|
||||||
async def health_check():
|
async def health_check():
|
||||||
return {"message": "JobSpy ready to scrape"}
|
return {"message": "JobSpy ready to scrape"}
|
||||||
|
|
Loading…
Reference in New Issue