Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add index api for monitoring if Gunicorn is down #555

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# CHANGELOG
All notable changes to this project will be documented here.

## [unreleased]
- Add index api for monitoring if Gunicorn is down (#555)

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

Expand Down
5 changes: 5 additions & 0 deletions client/autotest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,8 @@ def cancel_tests(settings_id, **_kw):
for id_, job in zip(test_ids, _get_jobs(test_ids, settings_id)):
result[id_] = job if job is None else job.cancel()
return jsonify(success=True)


@app.route("/index", methods=["GET"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this route status (and make naming changes throughout)

def index():
return jsonify(success=True)
10 changes: 10 additions & 0 deletions client/autotest_client/tests/test_flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ def test_api_key_set(self, response):

def test_credentials_set(self, response, fake_redis_conn, credentials):
assert json.loads(fake_redis_conn.hget("autotest:user_credentials", response.json["api_key"])) == credentials


class TestIndex:

@pytest.fixture
def response(self, client):
return client.get("/index")

def test_index(self, response):
assert response.status_code == 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good, but also test the JSON contents of the response

Loading