6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated tests\bugs\gh_6609_test.py: Separated definition of max ratio thresholds according to FB fork ('standard', 'HQbird', 'RedDatabase').

This commit is contained in:
pavel-zotov 2024-12-24 11:06:28 +03:00
parent 9c2a5e3755
commit 92fcac0ceb

View File

@ -19,6 +19,10 @@ NOTES:
4.0.5.3099, mon$memo_used ratio for CS: 1.01; SS: 1.00 4.0.5.3099, mon$memo_used ratio for CS: 1.01; SS: 1.00
5.0.1.1399, mon$memo_used ratio for CS: 1.11; SS: 1.02 5.0.1.1399, mon$memo_used ratio for CS: 1.11; SS: 1.02
6.0.0.351, mon$memo_used ratio for CS: 1.11; SS: 1.02 6.0.0.351, mon$memo_used ratio for CS: 1.11; SS: 1.02
[24.12.2024] pzotov
Separated definition of max ratio thresholds according to FB fork ('standard', 'HQbird', 'RedDatabase').
Requested by Anton Zuev, RedBase.
""" """
import pytest import pytest
@ -41,12 +45,41 @@ act = python_act('db')
@pytest.mark.version('>=3.0.0') @pytest.mark.version('>=3.0.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
#if act.platform == 'Windows': mon_memo_beg = 1
# pytest.skip('Could not reproduce bug on Windows') mon_memo_end = 9999999
with act.db.connect() as con:
if act.get_server_architecture() == 'SuperServer': # con.info.server_version output examples:
# Standard: 'WI-V6.3.2.1580 Firebird 5.0 7961de2'
# HQbird: 'WI-V6.3.2.1575 Firebird 5.0 HQbird'
# RedDatabase: 'LI-V6.3.2.0 RedDatabase 5.0 SNAPSHOT.15 (<sha>)'
#
fb_vers_txt = con.info.server_version
if 'RedDatabase' in fb_vers_txt:
fb_vers_key = 'red'
elif 'HQbird' in fb_vers_txt:
fb_vers_key = 'hqb'
else:
fb_vers_key = 'std'
###############################
### T H R E S H O L D S ###
###############################
# Requested by Anton Zuev, RedBase:
max_memo_ratios_map = {
('std', 'SuperServer') : 1.1
,('hqb', 'SuperServer') : 1.1
,('red', 'SuperServer') : 1.1
,('std', 'Classic') : 1.20
,('hqb', 'Classic') : 1.20
,('red', 'Classic') : 1.30
}
fb_mode = act.get_server_architecture()
MAX_THRESHOLD = max_memo_ratios_map[ fb_vers_key, fb_mode]
if fb_mode == 'SuperServer':
MON_QUERY = 'select mon$memory_used from mon$memory_usage where mon$stat_group = 0' MON_QUERY = 'select mon$memory_used from mon$memory_usage where mon$stat_group = 0'
MAX_THRESHOLD = 1.10
else: else:
MON_QUERY = """ MON_QUERY = """
select m.mon$memory_used select m.mon$memory_used
@ -54,11 +87,7 @@ def test_1(act: Action, capsys):
join mon$memory_usage m on a.mon$stat_id = m.mon$stat_id join mon$memory_usage m on a.mon$stat_id = m.mon$stat_id
where a.mon$attachment_id = current_connection and m.mon$stat_group = 1; where a.mon$attachment_id = current_connection and m.mon$stat_group = 1;
""" """
MAX_THRESHOLD = 1.20
mon_memo_beg = 1
mon_memo_end = 9999999
with act.db.connect() as con:
cur = con.cursor() cur = con.cursor()
cur.execute(MON_QUERY) cur.execute(MON_QUERY)
mon_memo_beg = int(cur.fetchone()[0]) mon_memo_beg = int(cur.fetchone()[0])