Skip to content

Commit

Permalink
fix(oonimeasurements): replace with weaker health check (#873)
Browse files Browse the repository at this point in the history
* fix: replace with weaker health check

* refactor: enable execute permissions on docker-smoketest
  • Loading branch information
DecFox committed Aug 11, 2024
1 parent 765942b commit 2a06746
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Empty file modified ooniapi/services/oonimeasurements/scripts/docker-smoketest.sh
100644 → 100755
Empty file.
13 changes: 6 additions & 7 deletions ooniapi/services/oonimeasurements/src/oonimeasurements/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from contextlib import asynccontextmanager

from fastapi import Depends, FastAPI, HTTPException
from fastapi import Depends, FastAPI
from fastapi.middleware.cors import CORSMiddleware

from pydantic import BaseModel
Expand Down Expand Up @@ -74,7 +74,7 @@ async def health(
errors = []

try:
query = f"""SELECT *
query = """SELECT *
FROM fastpath FINAL
"""
query_click(db=db, query=query, query_params={})
Expand All @@ -86,17 +86,16 @@ async def health(
err = "bad_jwt_secret"
log.error(err)
errors.append(err)

if settings.prometheus_metrics_password == "CHANGEME":
err = "bad_prometheus_password"
log.error(err)
errors.append(err)

if len(errors) > 0:
raise HTTPException(status_code=400, detail="health check failed")

status = "ok"

if len(errors) > 0:
status = "fail"

return {
"status": status,
"errors": errors,
Expand Down

0 comments on commit 2a06746

Please sign in to comment.