6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_5273_test.py

65 lines
2.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5551
ISSUE: 5551
TITLE: Crash when attempt to create database with running trace ( internal Firebird
consistency check (cannot find tip page (165), file: tra.cpp line: 2233) )
2022-01-25 22:55:48 +01:00
DESCRIPTION:
1. Get the content of firebird.log before test.
2. Make config file and launch trace session, with separate logging of its STDOUT and STDERR.
3. Make DDLfile and run ISQL, with separate logging of its STDOUT and STDERR.
4. Stop trace session
5. Get the content of firebird.log after test.
6. Ensure that files which should store STDERR results are empty.
7. Ensure that there is no difference in the content of firebird.log.
JIRA: CORE-5273
FBTEST: bugs.core_5273
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-12-06 19:23:35 +01:00
from difflib import unified_diff
from pathlib import Path
2022-01-25 22:55:48 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
temp_db = temp_file('tmp_5273.fdb')
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
trace = ['time_threshold = 0',
'log_sweep = true',
'log_errors = true',
'log_connections = true',
'log_statement_prepare = true',
'log_statement_start = true',
'log_statement_finish = true',
'log_statement_free = true',
'log_trigger_start = true',
'log_trigger_finish = true',
'print_perf = true',
'max_sql_length = 16384',
'max_log_size = 5000000',
]
2021-04-26 20:07:00 +02:00
2021-12-06 19:23:35 +01:00
@pytest.mark.version('>=4.0')
2022-01-25 22:55:48 +01:00
def test_1(act: Action, temp_db: Path):
2021-12-06 19:23:35 +01:00
sql_ddl = f"""
set list on;
set bail on;
2022-01-25 22:55:48 +01:00
create database 'localhost:{temp_db}';
2021-12-06 19:23:35 +01:00
select mon$database_name from mon$database;
commit;
drop database;
2022-01-25 22:55:48 +01:00
"""
2021-12-06 19:23:35 +01:00
# Get content of firebird.log BEFORE test
2022-01-25 22:55:48 +01:00
log_before = act.get_firebird_log()
2021-12-06 19:23:35 +01:00
# Start trace
2022-01-25 22:55:48 +01:00
with act.trace(db_events=trace, keep_log=False, database=temp_db.name):
act.isql(switches=[], input=sql_ddl)
2021-12-06 19:23:35 +01:00
# Get content of firebird.log AFTER test
2022-01-25 22:55:48 +01:00
log_after = act.get_firebird_log()
2021-12-06 19:23:35 +01:00
# Check
assert list(unified_diff(log_before, log_after)) == []