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

47 lines
1.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4621
ISSUE: 4621
TITLE: fbsvcmgr doesn't recognise sts_record_versions and other sts switches
DESCRIPTION:
JIRA: CORE-4298
FBTEST: bugs.core_4298
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-23 20:41:55 +01:00
from firebird.qa import *
2021-11-19 20:16:48 +01:00
from firebird.driver import SrvStatFlag
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
recreate table test(id int, x int);
commit;
insert into test values(1, 100);
insert into test values(2, 200);
insert into test values(3, 300);
insert into test values(4, 400);
insert into test values(5, 500);
commit;
2021-11-19 20:16:48 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory(init=init_script)
2021-11-19 20:16:48 +01:00
2022-01-23 20:41:55 +01:00
act = python_act('db', substitutions=[('Average version length: [\\d]+.[\\d]+, total versions: 5, max versions: 1',
'total versions: 5, max versions: 1')])
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
Average version length: 9.00, total versions: 5, max versions: 1
2021-11-19 20:16:48 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con:
2021-11-19 20:16:48 +01:00
c = con.cursor()
c.execute('update test set x = -x')
con.commit()
2022-01-23 20:41:55 +01:00
act.svcmgr(switches=['action_db_stats', 'dbname',
str(act.db.db_path), 'sts_record_versions'])
act.stdout = '\n'.join([line for line in act.stdout.splitlines() if 'versions:' in line.lower()])
act.expected_stdout = expected_stdout
assert act.clean_stdout == act.clean_expected_stdout