[
https://issues.apache.org/jira/browse/KNOX-3482?focusedWorklogId=1043724&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1043724
]
ASF GitHub Bot logged work on KNOX-3482:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Sep/26 12:33
Start Date: 24/Sep/26 12:33
Worklog Time Spent: 10m
Work Description: hanicz commented on code in PR #1426:
URL: https://github.com/apache/knox/pull/1426#discussion_r4093603924
##########
.github/workflows/tests/test_health.py:
##########
@@ -95,6 +95,56 @@ def test_health_ping_content_type_is_plain_text(self):
content_type = response.headers.get("Content-Type", "")
self.assertIn("text/plain", content_type)
+ def test_health_ping_accepts_post(self):
+ """Ping supports POST for health probes that cannot use GET."""
+ url = self.base_url + "gateway/health/v1/ping"
+ response = knox_post(url)
+
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.text.strip(), "OK")
+ self.assertIn("text/plain", response.headers.get("Content-Type", ""))
+ self.assertEqual(
+ response.headers.get("Cache-Control"),
+ "must-revalidate,no-cache,no-store",
+ )
+
+ def test_health_metrics_pretty_query_changes_serialization(self):
+ """The pretty query parameter produces human-readable JSON output."""
+ url = self.base_url + "gateway/health/v1/metrics"
+ compact = knox_get(url)
+ pretty = knox_get(url + "?pretty=true")
+
+ self.assertEqual(compact.status_code, 200)
+ self.assertEqual(pretty.status_code, 200)
+ self.assertTrue(
+ len(pretty.text) > len(compact.text),
+ msg="pretty metrics should include formatting whitespace",
+ )
+ self.assertIn("\n", pretty.text)
+ self.assertEqual(json.loads(compact.text), json.loads(pretty.text))
Review Comment:
I don't like this, this can easily fail in the future due to shakiness. You
compare two different live metric snapshots.
Issue Time Tracking
-------------------
Worklog Id: (was: 1043724)
Time Spent: 0.5h (was: 20m)
> Expand Knox health endpoint integration coverage
> ------------------------------------------------
>
> Key: KNOX-3482
> URL: https://issues.apache.org/jira/browse/KNOX-3482
> Project: Apache Knox
> Issue Type: Task
> Reporter: Raghav Maheshwari
> Priority: Major
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Add integration tests to the Docker-based test suite referenced by
> .github/workflows/tests.yml. The tests cover POST health probes, formatted
> metrics responses, gateway readiness states, response headers, and invalid
> endpoint paths.
> Scope:
> •Verify POST /gateway/health/v1/ping returns 200 OK.
> •Verify GET /gateway/health/v1/metrics?pretty=true returns formatted JSON
> equivalent to compact output.
> •Verify /gateway/health/v1/gateway-status returns OK or PENDING with required
> headers.
> •Verify unknown gateway-status suffixes return 404.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)