2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-25 22:55:48 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-5551
|
|
|
|
ISSUE: 5551
|
2024-05-15 19:26:01 +02:00
|
|
|
TITLE: Attempt to create database with running trace leads to 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
|
2022-02-02 15:46:19 +01:00
|
|
|
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
|
|
|
|
2024-05-15 19:26:01 +02:00
|
|
|
@pytest.mark.trace
|
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"""
|
2024-05-09 23:51:12 +02:00
|
|
|
set list on;
|
|
|
|
set bail on;
|
|
|
|
create database 'localhost:{temp_db}';
|
|
|
|
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()
|
2024-05-09 23:51:12 +02:00
|
|
|
|
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):
|
2024-05-09 23:51:12 +02:00
|
|
|
act.isql(switches = ['-q'], input = sql_ddl, connect_db = False, combine_output = True)
|
|
|
|
|
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()
|
2024-05-09 23:51:12 +02:00
|
|
|
|
2021-12-06 19:23:35 +01:00
|
|
|
# Check
|
|
|
|
assert list(unified_diff(log_before, log_after)) == []
|