Skip to content

Commit

Permalink
Temp remove DB connection from startup
Browse files Browse the repository at this point in the history
- Comment out healthcheck
- Comment out DB connection
- Modify healthcheck unit test
  • Loading branch information
MarcUsher committed Nov 14, 2024
1 parent e8db2c9 commit 31a74cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from connexion import FlaskApp
from flask import jsonify
from fsd_utils import init_sentry
from fsd_utils.healthchecks.checkers import DbChecker, FlaskRunningChecker
from fsd_utils.healthchecks.checkers import FlaskRunningChecker
from fsd_utils.healthchecks.healthcheck import Healthcheck
from fsd_utils.logging import logging

Expand All @@ -23,20 +23,20 @@ def create_app() -> FlaskApp:
flask_app = connexion_app.app
flask_app.config.from_object("config.Config")

from db import db, migrate
# from db import db, migrate

# Bind SQLAlchemy ORM to Flask app
db.init_app(flask_app)
# # Bind SQLAlchemy ORM to Flask app
# db.init_app(flask_app)

# Bind Flask-Migrate db utilities to Flask app
migrate.init_app(flask_app, db, directory="db/migrations", render_as_batch=True)
# # Bind Flask-Migrate db utilities to Flask app
# migrate.init_app(flask_app, db, directory="db/migrations", render_as_batch=True)

# Initialise logging
logging.init_app(flask_app)

health = Healthcheck(flask_app)
health.add_check(FlaskRunningChecker())
health.add_check(DbChecker(db))
# health.add_check(DbChecker(db))

@flask_app.errorhandler(404)
def not_found(error):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def test_healthchecks_endpoint(flask_test_client):
response = flask_test_client.get("/healthcheck")

expected_dict = {
"checks": [{"check_flask_running": "OK"}, {"check_db": "OK"}],
"checks": [{"check_flask_running": "OK"}],
"version": "123123",
}

Expand Down

0 comments on commit 31a74cd

Please sign in to comment.