diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2022-03-10 17:56:48 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2022-03-10 18:24:22 +0000 |
commit | d923d6792617e677da934836843d780cf44e52dc (patch) | |
tree | e0e708a17970f99ea8ce276b44706f61535b73e4 /main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java | |
parent | d4cbdf4a7e89c21810225a435234419b4346ac13 (diff) |
Fix PAP healthcheck response during failures
The healthcheck response that is returned by PAP is not inline with the
actual healthreport. Even when the report has
healthy:false, code:503, message:not alive
the response code stays 200. This is fixed, this also makes the improved
readiness probe in OOM to work properly with the healthcheck calls
Change-Id: Ib208e0a84bce74157aacbcad61a11dcf900c7c94
Issue-ID: POLICY-4030
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java index 896f2aac..2687a302 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/HealthCheckRestControllerV1.java @@ -53,7 +53,8 @@ public class HealthCheckRestControllerV1 extends PapRestControllerV1 { @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE), @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)}) public ResponseEntity<HealthCheckReport> healthcheck() { - return ResponseEntity.ok().body(provider.performHealthCheck(true)); + var report = provider.performHealthCheck(true); + return ResponseEntity.status(report.getCode()).body(report); } } |