@onlineapps/infrastructure-tools 1.0.49 → 1.0.51
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/README.md
CHANGED
|
@@ -80,10 +80,11 @@ Access MinIO storage for infrastructure services:
|
|
|
80
80
|
const { StorageCore } = require('@onlineapps/infrastructure-tools');
|
|
81
81
|
|
|
82
82
|
const storage = new StorageCore({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
// FAIL-FAST: topology must be explicit (no defaults for hosts/credentials)
|
|
84
|
+
endPoint: process.env.MINIO_ENDPOINT,
|
|
85
|
+
port: parseInt(process.env.MINIO_PORT, 10),
|
|
86
|
+
accessKey: process.env.MINIO_ACCESS_KEY,
|
|
87
|
+
secretKey: process.env.MINIO_SECRET_KEY
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
await storage.initialize();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/infrastructure-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.51",
|
|
4
4
|
"description": "Infrastructure orchestration utilities for OA Drive infrastructure services (health tracking, queue initialization, service discovery)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@onlineapps/mq-client-core": "1.0.67",
|
|
22
22
|
"@onlineapps/service-common": "1.0.12",
|
|
23
|
-
"@onlineapps/storage-core": "1.0.
|
|
23
|
+
"@onlineapps/storage-core": "1.0.10",
|
|
24
24
|
"uuid": "^9.0.1",
|
|
25
25
|
"@onlineapps/infra-logger": "^1.0.0"
|
|
26
26
|
},
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
jest.mock('@onlineapps/service-common', () => ({
|
|
4
|
-
sendMonitoringFailFallbackEmail: jest.fn().mockResolvedValue(true)
|
|
5
|
-
}));
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
sendQueueMismatchAlert,
|
|
9
|
-
_internal
|
|
10
|
-
} = require('../../src/monitoring/queueMismatchReporter');
|
|
11
|
-
const { sendMonitoringFailFallbackEmail } = require('@onlineapps/service-common');
|
|
12
|
-
|
|
13
|
-
describe('queueMismatchReporter @unit', () => {
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
jest.clearAllMocks();
|
|
16
|
-
_internal.lastAlertMap.clear();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('sends fallback email for queue mismatch', async () => {
|
|
20
|
-
await sendQueueMismatchAlert({
|
|
21
|
-
serviceName: 'test-service',
|
|
22
|
-
queueName: 'workflow.init',
|
|
23
|
-
expectedArguments: { 'x-message-ttl': 60000 },
|
|
24
|
-
error: new Error('PRECONDITION_FAILED')
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
expect(sendMonitoringFailFallbackEmail).toHaveBeenCalledTimes(1);
|
|
28
|
-
const [subject, text] = sendMonitoringFailFallbackEmail.mock.calls[0];
|
|
29
|
-
expect(subject).toContain('test-service');
|
|
30
|
-
expect(text).toContain('workflow.init');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('throttles duplicate alerts within cooldown', async () => {
|
|
34
|
-
await sendQueueMismatchAlert({
|
|
35
|
-
serviceName: 'test-service',
|
|
36
|
-
queueName: 'workflow.init',
|
|
37
|
-
cooldownMs: 60000
|
|
38
|
-
});
|
|
39
|
-
await sendQueueMismatchAlert({
|
|
40
|
-
serviceName: 'test-service',
|
|
41
|
-
queueName: 'workflow.init',
|
|
42
|
-
cooldownMs: 60000
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
expect(sendMonitoringFailFallbackEmail).toHaveBeenCalledTimes(1);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
|