4
4
from ydb .tests .olap .lib .results_processor import ResultsProcessor
5
5
from urllib .parse import urlencode
6
6
from datetime import datetime
7
+ from copy import deepcopy
7
8
8
9
9
10
def allure_test_description (
@@ -21,29 +22,46 @@ def _pretty_str(s):
21
22
allure .dynamic .title (f'{ suite } .{ test } ' )
22
23
for body , name , type in attachments :
23
24
allure .attach (body , name , type )
24
- test_info = YdbCluster .get_cluster_info ()
25
+ test_info = deepcopy ( YdbCluster .get_cluster_info () )
25
26
if test_info ['name' ].startswith ('ydb-k8s' ):
26
27
core_link = f"https://coredumps.n.yandex-team.ru/index?itype=kikimr&host_list={ test_info ['nodes_wilcard' ]} &show_fixed=True"
27
28
else :
28
29
core_link = f"https://kikimr-cores.n.yandex-team.ru/show?server={ test_info ['nodes_wilcard' ]} %2A"
29
- monitoring_cluster = (
30
- YdbCluster .monitoring_cluster if YdbCluster .monitoring_cluster is not None else test_info ['name' ]
31
- )
30
+ del test_info ['nodes_wilcard' ]
32
31
test_info .update (addition_table_strings )
32
+ monitoring_start = int ((start_time ) * 1000 )
33
+ monitoring_end = int ((end_time ) * 1000 )
34
+ # monitoring does not show intervals less 1 minute.
35
+ monitoring_addition = 60000 - (monitoring_end - monitoring_start )
36
+ if monitoring_addition > 0 :
37
+ monitoring_start -= monitoring_addition
38
+ monitoring_end += monitoring_addition
39
+
40
+ service_url = YdbCluster ._get_service_url ()
41
+
42
+ def _get_monitoring_link (monitoring : YdbCluster .MonitoringUrl ):
43
+ return f"<a target='_blank' href='{ monitoring .url .format (
44
+ database = '/' + test_info ['database' ],
45
+ start_time = monitoring_start ,
46
+ end_time = monitoring_end
47
+ )} '>{ monitoring .caption } </a>"
48
+
49
+ monitoring = ', ' .join ([
50
+ _get_monitoring_link (monitoring )
51
+ for monitoring in YdbCluster .get_monitoring_urls ()
52
+ ])
53
+
33
54
test_info .update (
34
55
{
35
56
'table_path' : YdbCluster .tables_path ,
36
- 'monitoring' : (
37
- f"<a target='_blank' href='https://monitoring.yandex-team.ru/projects/kikimr/dashboards/mone0310v4dbc6kui89v?"
38
- f"p.cluster={ monitoring_cluster } &p.database=/{ test_info ['database' ]} &from={ int (start_time * 1000 )} &to={ int (end_time * 1000 )} '>link</a>"
39
- ),
57
+ 'monitoring' : monitoring ,
40
58
'coredumps' : f"<a target='_blank' href='{ core_link } '>link</a>" ,
41
59
'db_admin' : (
42
- f"<a target='_blank' href='{ test_info [ ' service_url' ] } /monitoring/tenant?"
60
+ f"<a target='_blank' href='{ service_url } /monitoring/tenant?"
43
61
f"schema=/{ test_info ['database' ]} /{ YdbCluster .tables_path } &tenantPage=query"
44
- f"&diagnosticsTab=nodes&name=/{ test_info ['database' ]} '>link </a>"
62
+ f"&diagnosticsTab=nodes&name=/{ test_info ['database' ]} '>{ service_url } </a>"
45
63
),
46
- 'timestamp ' : datetime .now ( ).strftime ('%c' ) ,
64
+ 'time ' : f" { datetime .fromtimestamp ( start_time ).strftime ('%a %d %b %y %H:%M:%S' ) } - { datetime . fromtimestamp ( end_time ). strftime ( '%H:%M:%S' ) } " ,
47
65
}
48
66
)
49
67
if ResultsProcessor .send_results :
0 commit comments