Skip to content

Commit 7104dd7

Browse files
authored
Add status API route for monitoring server status (#555)
1 parent 1b2c04e commit 7104dd7

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ All notable changes to this project will be documented here.
33

44
## [unreleased]
55
- Haskell Tests - allow displaying of compilation errors (#554)
6+
- Add status api for monitoring if Gunicorn is down (#555)
67

78
## [v2.5.1]
89
- Ensure all Haskell test cases still run within same file when there are failed test cases (#543)

client/autotest_client/__init__.py

+5
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,8 @@ def cancel_tests(settings_id, **_kw):
319319
for id_, job in zip(test_ids, _get_jobs(test_ids, settings_id)):
320320
result[id_] = job if job is None else job.cancel()
321321
return jsonify(success=True)
322+
323+
324+
@app.route("/status", methods=["GET"])
325+
def status():
326+
return jsonify(success=True)

client/autotest_client/tests/test_flask_app.py

+13
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ def test_api_key_set(self, response):
3838

3939
def test_credentials_set(self, response, fake_redis_conn, credentials):
4040
assert json.loads(fake_redis_conn.hget("autotest:user_credentials", response.json["api_key"])) == credentials
41+
42+
43+
class TestStatus:
44+
45+
@pytest.fixture
46+
def response(self, client):
47+
return client.get("/status")
48+
49+
def test_status_code(self, response):
50+
assert response.status_code == 200
51+
52+
def test_success(self, response):
53+
assert response.json["success"] is True

0 commit comments

Comments
 (0)