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 endpoint to test kobocat health #910

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions onadata/apps/main/service_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ def service_health(request):
output, status=(500 if any_failure else 200), content_type='text/plain'
)

def service_health_minimal(request):
return HttpResponse("ok", content_type="text/plain")
13 changes: 13 additions & 0 deletions onadata/apps/main/tests/test_service_health_minimal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.test import TestCase
from django.urls import reverse


class ServiceHealthMinimalTestCase(TestCase):
url = reverse("service-health-minimal")

def test_service_health_minimal(self):
with self.assertNumQueries(0):
res = self.client.get(self.url)

# Check that the response content contains "ok"
self.assertContains(res, "ok")
5 changes: 3 additions & 2 deletions onadata/apps/main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.conf import settings
from django.contrib import admin

from django.urls import include, re_path
from django.urls import include, re_path, path
from django.views.generic import RedirectView
from django.views.i18n import JavaScriptCatalog

Expand All @@ -11,7 +11,7 @@
from onadata.apps.api.urls import XFormListApi
from onadata.apps.api.urls import XFormSubmissionApi
from onadata.apps.api.urls import router, router_with_patch_list
from onadata.apps.main.service_health import service_health
from onadata.apps.main.service_health import service_health, service_health_minimal

# exporting stuff
from onadata.apps.viewer.views import (
Expand All @@ -37,6 +37,7 @@
re_path('^api/v1/', include(router.urls)),
re_path('^api/v1/', include(router_with_patch_list.urls)),
re_path(r'^service_health/$', service_health),
path(r'service_health/minimal/', service_health_minimal, name='service-health-minimal'),
re_path(r'^api/', RedirectView.as_view(url='/api/v1/')),
re_path(r'^api/v1', RedirectView.as_view(url='/api/v1/')),

Expand Down
Loading