Skip to content

Commit eb7f605

Browse files
authored
add condition to reflect gateway response as good when onprem (#1757)
1 parent 7092618 commit eb7f605

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ansible_ai_connect/healthcheck/tests/test_healthcheck.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,18 @@ def test_liveness_probe(self):
186186
data = json.loads(r.content)
187187
self.assert_common_data(data, "ok", settings.DEPLOYED_REGION)
188188

189+
@override_settings(DEPLOYMENT_MODE="onprem")
190+
def test_liveness_probe_onprem(self):
191+
with patch.object(
192+
apps.get_app_config("ai"),
193+
"get_model_pipeline",
194+
Mock(return_value=DummyCompletionsPipeline(mock_pipeline_config("dummy"))),
195+
):
196+
r = self.client.get(reverse("liveness_probe"), format="json")
197+
self.assertEqual(r.status_code, HTTPStatus.OK)
198+
data = json.loads(r.content)
199+
self.assert_common_data(data, "good", settings.DEPLOYED_REGION)
200+
189201
def test_health_check_all_healthy(self):
190202
cache.clear()
191203
with patch.object(

ansible_ai_connect/healthcheck/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ class WisdomServiceLivenessProbeView(APIView):
162162
@method_decorator(never_cache)
163163
def get(self, request, *args, **kwargs):
164164
data = common_data()
165-
data["status"] = "ok"
165+
if settings.DEPLOYMENT_MODE == "onprem":
166+
data["status"] = "good"
167+
else:
168+
data["status"] = "ok"
166169
data_json = json.dumps(data)
167170
return HttpResponse(data_json, content_type="application/json")
168171

0 commit comments

Comments
 (0)