mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated bugs\core_3328_test.py. Minor changes related to firebird.log diff analyzing. Checked on Windows: 3.0.8.33535 (SS/CS), 4.0.1.2692 (SS/CS), 5.0.0.691
This commit is contained in:
parent
8227f98f8a
commit
fa9bd02c1a
@ -9,11 +9,15 @@ DESCRIPTION:
|
||||
If these words absent - all fine, actual and expected output both have to be empty.
|
||||
JIRA: CORE-3328
|
||||
FBTEST: bugs.core_3328
|
||||
NOTES:
|
||||
[13.09.2022] pzotov
|
||||
Checked on Windows: 3.0.8.33535 (SS/CS), 4.0.1.2692 (SS/CS), 5.0.0.691
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import time
|
||||
from difflib import unified_diff
|
||||
import re
|
||||
from threading import Thread
|
||||
from firebird.qa import *
|
||||
from firebird.driver import ShutdownMethod, ShutdownMode
|
||||
@ -27,14 +31,14 @@ db = db_factory(init=init_script)
|
||||
|
||||
act = python_act('db', substitutions=[('database.*shutdown', 'database shutdown')])
|
||||
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = HY000
|
||||
database /tmp/pytest-of-pcisar/pytest-528/test_10/test.fdb shutdown
|
||||
Statement failed, SQLSTATE = HY000
|
||||
database /tmp/pytest-of-pcisar/pytest-528/test_10/test.fdb shutdown
|
||||
"""
|
||||
|
||||
def run_work(act: Action):
|
||||
expected_stderr = """
|
||||
Statement failed, SQLSTATE = HY000
|
||||
database test.fdb shutdown
|
||||
Statement failed, SQLSTATE = HY000
|
||||
database test.fdb shutdown
|
||||
"""
|
||||
test_script = """
|
||||
show version;
|
||||
set term ^;
|
||||
@ -54,25 +58,29 @@ def run_work(act: Action):
|
||||
act.isql(switches=['-n'], input=test_script)
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act: Action):
|
||||
def test_1(act: Action, capsys):
|
||||
with act.connect_server() as srv:
|
||||
srv.info.get_log()
|
||||
log_before = srv.readlines()
|
||||
#
|
||||
log_before = act.get_firebird_log()
|
||||
|
||||
work_thread = Thread(target=run_work, args=[act])
|
||||
work_thread.start()
|
||||
time.sleep(2)
|
||||
#
|
||||
srv.database.shutdown(database=act.db.db_path, mode=ShutdownMode.FULL,
|
||||
method=ShutdownMethod.FORCED, timeout=0)
|
||||
srv.database.bring_online(database=act.db.db_path)
|
||||
#
|
||||
srv.info.get_log()
|
||||
log_after = srv.readlines()
|
||||
#
|
||||
|
||||
work_thread.join(2)
|
||||
if work_thread.is_alive():
|
||||
pytest.fail('Work thread is still alive')
|
||||
#
|
||||
assert list(unified_diff(log_before, log_after)) == []
|
||||
assert act.clean_stderr == act.clean_expected_stderr
|
||||
|
||||
log_after = act.get_firebird_log()
|
||||
log_diff = list(unified_diff(log_before, log_after))
|
||||
|
||||
p_dbshut = re.compile('database.*shutdown', re.IGNORECASE)
|
||||
p_diff = [p for p in log_diff if p.startswith('+') and p_dbshut.search(p)]
|
||||
if p_diff:
|
||||
print('UNEXPECTED LINES IN LOG DIFF:')
|
||||
for p in p_diff:
|
||||
print(p)
|
||||
|
||||
assert '' == capsys.readouterr().out
|
||||
|
Loading…
Reference in New Issue
Block a user