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

HAAR-1891: Add newly-included Manage Users api to health checks #255

Merged
merged 2 commits into from
Nov 7, 2023
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

---

**November 6th 2023** – Add HMPPS Manage Users API to health checks

PR: [#255](https://github.com/ministryofjustice/hmpps-template-typescript/pull/255)

---

**October 27th 2023** – Update to 4.0.0 of `jwt-decode` module

This had breaking changes and required an update to the import statement
Expand Down
1 change: 1 addition & 0 deletions integration_tests/e2e/health.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ context('Healthcheck', () => {
beforeEach(() => {
cy.task('reset')
cy.task('stubAuthPing')
cy.task('stubManageUsersPing')
cy.task('stubTokenVerificationPing')
})

Expand Down
12 changes: 12 additions & 0 deletions integration_tests/mockApis/manageUsersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@ const stubUserRoles = () =>
},
})

const ping = () =>
stubFor({
request: {
method: 'GET',
urlPattern: '/manage-users-api/health/ping',
},
response: {
status: 200,
},
})

export default {
stubManageUser: (name = 'john smith'): Promise<[Response, Response]> =>
Promise.all([stubUser(name), stubUserRoles()]),
stubManageUsersPing: ping,
Comment on lines +40 to +54
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the stubbing code is copied almost verbatim from auth

}
1 change: 1 addition & 0 deletions server/services/healthCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function gatherCheckInfo(aggregateStatus: Record<string, unknown>, currentStatus

const apiChecks = [
service('hmppsAuth', `${config.apis.hmppsAuth.url}/health/ping`, config.apis.hmppsAuth.agent),
service('manageUsersApi', `${config.apis.manageUsersApi.url}/health/ping`, config.apis.manageUsersApi.agent),
...(config.apis.tokenVerification.enabled
? [
service(
Expand Down