|
1 | | -import {getMonitoringLink} from '../monitoring'; |
| 1 | +import {getMonitoringClusterLink, getMonitoringLink} from '../monitoring'; |
2 | 2 |
|
3 | 3 | describe('getMonitoringLink', () => { |
4 | | - it('should create link with solomon for Israel version', () => { |
5 | | - const monitoringRaw = { |
6 | | - monitoring_url: |
7 | | - 'https://some-monitoring.org/?project=yc.ydb.ydbaas-cloud&cluster=global', |
| 4 | + it('should create database monitoring link from JSON', () => { |
| 5 | + const solomonRaw = { |
| 6 | + monitoring_url: 'https://monitoring.test.ai/projects/yc.ydb.ydbaas-cloud/dashboards', |
8 | 7 | serverless_dashboard: '', |
9 | | - dedicated_dashboard: 'ydb-mt-database-overall', |
| 8 | + dedicated_dashboard: 'aol34hftdn7o4fls50sv', |
10 | 9 | }; |
11 | | - const monitoringString = JSON.stringify(monitoringRaw); |
12 | | - |
13 | | - expect( |
14 | | - getMonitoringLink({ |
15 | | - monitoring: monitoringString, |
16 | | - clusterName: 'global', |
17 | | - dbName: '/global/yc.ydb.ydbaas-cloud/uvu6j9kjcel12pem7', |
18 | | - dbType: 'Serverless', |
19 | | - }), |
20 | | - ).toBe( |
21 | | - 'https://some-monitoring.org/?project=yc.ydb.ydbaas-cloud&cluster=global&host=cluster&slot=static&database=/global/yc.ydb.ydbaas-cloud/uvu6j9kjcel12pem7&dashboard=', |
22 | | - ); |
| 10 | + const solomonString = JSON.stringify(solomonRaw); |
23 | 11 |
|
24 | 12 | expect( |
25 | 13 | getMonitoringLink({ |
26 | | - monitoring: monitoringString, |
| 14 | + monitoring: solomonString, |
27 | 15 | clusterName: 'global', |
28 | | - dbName: '/global/audit-trails', |
| 16 | + dbName: 'database', |
29 | 17 | dbType: 'Database', |
30 | 18 | }), |
31 | 19 | ).toBe( |
32 | | - 'https://some-monitoring.org/?project=yc.ydb.ydbaas-cloud&cluster=global&host=cluster&slot=static&database=/global/audit-trails&dashboard=ydb-mt-database-overall', |
| 20 | + 'https://monitoring.test.ai/projects/yc.ydb.ydbaas-cloud/dashboards/aol34hftdn7o4fls50sv?p.cluster=global&p.host=cluster&p.slot=static&p.database=database', |
33 | 21 | ); |
34 | 22 | }); |
35 | | - it('should create link with monitoring for Nebius version', () => { |
| 23 | + it('should create cluster monitoring link from JSON', () => { |
36 | 24 | const solomonRaw = { |
37 | 25 | monitoring_url: 'https://monitoring.test.ai/projects/yc.ydb.ydbaas-cloud/dashboards', |
38 | | - serverless_dashboard: '', |
39 | | - dedicated_dashboard: 'aol34hftdn7o4fls50sv', |
| 26 | + cluster_dashboard: 'aol34hftdn7o4fls50sv', |
40 | 27 | }; |
41 | 28 | const solomonString = JSON.stringify(solomonRaw); |
42 | 29 |
|
| 30 | + expect(getMonitoringClusterLink(solomonString, 'clusterName')).toBe( |
| 31 | + 'https://monitoring.test.ai/projects/yc.ydb.ydbaas-cloud/dashboards/aol34hftdn7o4fls50sv/view?p.cluster=clusterName&p.database=-', |
| 32 | + ); |
| 33 | + }); |
| 34 | + it('should not parse ready to use database monitoring link', () => { |
| 35 | + const solomonRaw = { |
| 36 | + monitoring_url: |
| 37 | + 'https://monitoring.test.ai/projects/ydbaas/dashboards/aol34hftdn7o4fls50sv?p.cluster=cluster_name&a=', |
| 38 | + }; |
| 39 | + |
| 40 | + const solomonString = JSON.stringify(solomonRaw); |
| 41 | + |
43 | 42 | expect( |
44 | 43 | getMonitoringLink({ |
45 | 44 | monitoring: solomonString, |
46 | | - clusterName: 'global', |
47 | | - dbName: '/global/audit-trails', |
48 | | - dbType: 'Database', |
| 45 | + dbName: 'database', |
| 46 | + dbType: 'Dedicated', |
49 | 47 | }), |
50 | 48 | ).toBe( |
51 | | - 'https://monitoring.test.ai/projects/yc.ydb.ydbaas-cloud/dashboards/aol34hftdn7o4fls50sv?p.cluster=global&p.host=cluster&p.slot=static&p.database=/global/audit-trails', |
| 49 | + 'https://monitoring.test.ai/projects/ydbaas/dashboards/aol34hftdn7o4fls50sv?p.cluster=cluster_name&a=&p.host=cluster&p.slot=static&p.database=database', |
| 50 | + ); |
| 51 | + }); |
| 52 | + it('should not parse ready to use cluster monitoring link', () => { |
| 53 | + const solomonRaw = { |
| 54 | + monitoring_url: |
| 55 | + 'https://monitoring.test.ai/projects/ydbaas/dashboards/aol34hftdn7o4fls50sv/view?p.cluster=cluster_name&a=', |
| 56 | + }; |
| 57 | + |
| 58 | + const solomonString = JSON.stringify(solomonRaw); |
| 59 | + |
| 60 | + expect(getMonitoringClusterLink(solomonString)).toBe( |
| 61 | + 'https://monitoring.test.ai/projects/ydbaas/dashboards/aol34hftdn7o4fls50sv/view?p.cluster=cluster_name&a=&p.database=-', |
52 | 62 | ); |
53 | 63 | }); |
54 | 64 | }); |
0 commit comments