6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_3413_test.py

41 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3776
ISSUE: 3776
TITLE: Improve diagnostics of internal trace errors
DESCRIPTION:
JIRA: CORE-3413
FBTEST: bugs.core_3413
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
substitutions = [('^((?!ERROR|ELEMENT).)*$', ''),
('ERROR CREATING TRACE SESSION.*', 'ERROR CREATING TRACE SESSION'),
('.*"FOO" IS NOT A VALID.*', '"FOO" IS NOT A VALID')]
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-11-17 19:43:06 +01:00
2022-01-22 21:59:15 +01:00
act = python_act('db', substitutions=substitutions)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
ERROR CREATING TRACE SESSION FOR DATABASE
ERROR WHILE PARSING TRACE CONFIGURATION
ELEMENT "LOG_STATEMENT_FINISH": "FOO" IS NOT A VALID
2021-11-17 19:43:06 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
trace = ['time_threshold = 0',
'log_statement_finish = foo'
]
2021-04-26 20:07:00 +02:00
@pytest.mark.trace
2021-11-17 19:43:06 +01:00
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
with act.trace(db_events=trace):
act.isql(switches=['-n'], input='select 1 as c from rdb$database;')
act.expected_stdout = expected_stdout
act.trace_to_stdout(upper=True)
assert act.clean_stdout == act.clean_expected_stdout