account-lookup-service 17.11.1-snapshot.0 → 17.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +1 -1
- package/CHANGELOG.md +16 -0
- package/package.json +6 -6
- package/sbom-v17.11.1.csv +1524 -0
- package/src/api/health.js +2 -3
- package/src/handlers/monitoring/plugins/health.js +2 -2
- package/src/lib/healthCheck/subServiceHealth.js +1 -25
- package/test/unit/api/health.test.js +4 -4
package/src/api/health.js
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
'use strict'
|
28
28
|
|
29
29
|
const HealthCheck = require('@mojaloop/central-services-shared').HealthCheck.HealthCheck
|
30
|
-
const { getSubServiceHealthDatastore, getProxyCacheHealth
|
30
|
+
const { getSubServiceHealthDatastore, getProxyCacheHealth } = require('../lib/healthCheck/subServiceHealth')
|
31
31
|
const packageJson = require('../../package.json')
|
32
32
|
const Config = require('../lib/config')
|
33
33
|
|
@@ -36,8 +36,7 @@ const getSubServices = (appConfig, isAdmin) => {
|
|
36
36
|
return [getSubServiceHealthDatastore]
|
37
37
|
}
|
38
38
|
|
39
|
-
const subServices = [getSubServiceHealthDatastore
|
40
|
-
|
39
|
+
const subServices = [getSubServiceHealthDatastore]
|
41
40
|
if (appConfig.PROXY_CACHE_CONFIG.enabled) {
|
42
41
|
subServices.push(getProxyCacheHealth)
|
43
42
|
}
|
@@ -20,14 +20,14 @@
|
|
20
20
|
|
21
21
|
const { HealthCheck } = require('@mojaloop/central-services-shared').HealthCheck
|
22
22
|
const { defaultHealthHandler } = require('@mojaloop/central-services-health')
|
23
|
-
const { getProxyCacheHealth
|
23
|
+
const { getProxyCacheHealth } = require('../../../lib/healthCheck/subServiceHealth')
|
24
24
|
const packageJson = require('../../../../package.json')
|
25
25
|
|
26
26
|
let healthCheck
|
27
27
|
|
28
28
|
const createHealthCheck = ({ proxyCache }) => {
|
29
29
|
return new HealthCheck(packageJson, [
|
30
|
-
() => getProxyCacheHealth(proxyCache)
|
30
|
+
() => getProxyCacheHealth(proxyCache)
|
31
31
|
])
|
32
32
|
}
|
33
33
|
|
@@ -26,7 +26,6 @@
|
|
26
26
|
const { statusEnum, serviceName } = require('@mojaloop/central-services-shared').HealthCheck.HealthCheckEnums
|
27
27
|
const { logger } = require('../../lib')
|
28
28
|
const MigrationLockModel = require('../../models/misc/migrationLock')
|
29
|
-
const Producer = require('@mojaloop/central-services-stream').Util.Producer
|
30
29
|
|
31
30
|
/**
|
32
31
|
* @function getSubServiceHealthDatastore
|
@@ -55,28 +54,6 @@ const getSubServiceHealthDatastore = async () => {
|
|
55
54
|
}
|
56
55
|
}
|
57
56
|
|
58
|
-
/**
|
59
|
-
* @function getSubServiceHealthBroker
|
60
|
-
*
|
61
|
-
* @description Gets the health for the Notification broker
|
62
|
-
* @returns Promise<object> The SubService health object for the broker
|
63
|
-
*/
|
64
|
-
const getSubServiceHealthBroker = async () => {
|
65
|
-
let status = statusEnum.OK
|
66
|
-
try {
|
67
|
-
await Producer.allConnected()
|
68
|
-
status = statusEnum.OK
|
69
|
-
} catch (err) {
|
70
|
-
logger.isDebugEnabled && logger.debug(`getSubServiceHealthBroker failed with error: ${err.message}.`)
|
71
|
-
status = statusEnum.DOWN
|
72
|
-
}
|
73
|
-
|
74
|
-
return {
|
75
|
-
name: serviceName.broker,
|
76
|
-
status
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
57
|
/**
|
81
58
|
* @function getProxyCacheHealth
|
82
59
|
*
|
@@ -102,6 +79,5 @@ const getProxyCacheHealth = async (proxyCache) => {
|
|
102
79
|
|
103
80
|
module.exports = {
|
104
81
|
getSubServiceHealthDatastore,
|
105
|
-
getProxyCacheHealth
|
106
|
-
getSubServiceHealthBroker
|
82
|
+
getProxyCacheHealth
|
107
83
|
}
|
@@ -86,7 +86,7 @@ describe('/health', () => {
|
|
86
86
|
expect(response.statusCode).toBe(200)
|
87
87
|
const payload = JSON.parse(response.payload)
|
88
88
|
expect(payload.status).toBe('OK')
|
89
|
-
expect(payload.services.length).toBe(
|
89
|
+
expect(payload.services.length).toBe(1)
|
90
90
|
expect(payload.services[0].name).toBe('datastore')
|
91
91
|
})
|
92
92
|
|
@@ -108,7 +108,7 @@ describe('/health', () => {
|
|
108
108
|
expect(response.statusCode).toBe(503)
|
109
109
|
const payload = JSON.parse(response.payload)
|
110
110
|
expect(payload.status).toBe('DOWN')
|
111
|
-
expect(payload.services.length).toBe(
|
111
|
+
expect(payload.services.length).toBe(1)
|
112
112
|
expect(payload.services[0].name).toBe('datastore')
|
113
113
|
})
|
114
114
|
|
@@ -135,8 +135,8 @@ describe('/health', () => {
|
|
135
135
|
// Assert
|
136
136
|
const payload = JSON.parse(response.payload)
|
137
137
|
expect(response.statusCode).toBe(200)
|
138
|
-
expect(payload.services.length).toBe(
|
139
|
-
expect(payload.services[
|
138
|
+
expect(payload.services.length).toBe(2)
|
139
|
+
expect(payload.services[1].name).toBe('proxyCache')
|
140
140
|
} finally {
|
141
141
|
serverWithProxy && await serverWithProxy.stop()
|
142
142
|
}
|