6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 10:50:42 +01:00

Added 'pytest.mark.trace' to all tests which launch trace. Purpose: reduce time of QA run which started only to check whether trace session can cause pytest hang at the end of run.

This commit is contained in:
pavel-zotov 2024-05-15 20:26:01 +03:00
parent a70397a548
commit 40741bd449
67 changed files with 230 additions and 4 deletions

View File

@ -69,6 +69,7 @@ trace = [
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -127,6 +127,7 @@ trace = ['include_filter = %(SELECT|INSERT|UPDATE|DELETE)%',
'max_arg_count = 30', 'max_arg_count = 30',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3') @pytest.mark.version('>=3')
def test_1(act: Action): def test_1(act: Action):
# Get content of firebird.log BEFORE test # Get content of firebird.log BEFORE test

View File

@ -28,6 +28,7 @@ trace = ['log_connections = true',
'time_threshold = 0', 'time_threshold = 0',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -29,6 +29,7 @@ trace = ['log_services = true',
temp_file = temp_file('test-file') temp_file = temp_file('test-file')
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, temp_file): def test_1(act: Action, temp_file):
with act.trace(svc_events=trace), act.connect_server() as srv: with act.trace(svc_events=trace), act.connect_server() as srv:

View File

@ -30,6 +30,7 @@ trace = ['time_threshold = 0',
'log_statement_finish = foo' 'log_statement_finish = foo'
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -136,6 +136,7 @@ trace = ['log_transactions = true',
'log_initfini = false', 'log_initfini = false',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3') @pytest.mark.version('>=3')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
NUM_ROWS_TO_BE_ADDED = 45000 NUM_ROWS_TO_BE_ADDED = 45000

View File

@ -83,6 +83,7 @@ trace = ['log_transactions = true',
'log_initfini = false', 'log_initfini = false',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
expected_stdout = '' expected_stdout = ''

View File

@ -41,6 +41,7 @@ svc_items = [
'log_errors = true', 'log_errors = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3') @pytest.mark.version('>=3')
def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys): def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys):
#print( os.environ.get('ISC_USER', 'UNKNOWN_ISC_USR') ) #print( os.environ.get('ISC_USER', 'UNKNOWN_ISC_USR') )

View File

@ -44,6 +44,7 @@ expected_stdout_isql = """
-At block line: 3, col: 13 -At block line: 3, col: 13
""" """
@pytest.mark.trace
@pytest.mark.version('>=3') @pytest.mark.version('>=3')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -38,6 +38,7 @@ def check_sweep(act: Action, log_sweep: bool):
with act.trace(db_events=cfg), act.connect_server() as srv: with act.trace(db_events=cfg), act.connect_server() as srv:
srv.database.sweep(database=act.db.db_path) srv.database.sweep(database=act.db.db_path)
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
# Case 1 - sweep logged # Case 1 - sweep logged

View File

@ -72,6 +72,7 @@ trace = ['time_threshold = 0',
'log_statement_start = true', 'log_statement_start = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3') @pytest.mark.version('>=3')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -66,6 +66,7 @@ trace = ['time_threshold = 0',
'log_trigger_finish = true', 'log_trigger_finish = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
# How many rows must be inserted to the test table: # How many rows must be inserted to the test table:

View File

@ -52,6 +52,8 @@ trace_conf = """
""".split('\n') """.split('\n')
NO_SUCH_ALIAS = 'n0_$uch_f1le' NO_SUCH_ALIAS = 'n0_$uch_f1le'
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -133,6 +133,7 @@ trace = ['time_threshold = 0',
'log_connections = true', 'log_connections = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, sweep_log: Path, capsys): def test_1(act: Action, sweep_log: Path, capsys):

View File

@ -74,6 +74,7 @@ trace = ['time_threshold = 0',
'log_function_finish = true' 'log_function_finish = true'
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
output = [] output = []

View File

@ -34,6 +34,7 @@ trace = ['time_threshold = 0',
'include_filter=%(from|join)[[:whitespace:]]test%', 'include_filter=%(from|join)[[:whitespace:]]test%',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -54,6 +54,7 @@ trace = [
'log_errors = true', 'log_errors = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -99,6 +99,7 @@ trace = ['time_threshold = 0',
'print_perf = true', 'print_perf = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -61,6 +61,7 @@ join rdb$roles r on p.rdb$relation_name = r.rdb$role_name
where p.rdb$user = upper('TMP$C5269_2'); where p.rdb$user = upper('TMP$C5269_2');
""" """
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, user_a: User, user_b: User, test_role: Role): def test_1(act: Action, user_a: User, user_b: User, test_role: Role):
with act.db.connect() as con: with act.db.connect() as con:

View File

@ -3,8 +3,7 @@
""" """
ID: issue-5551 ID: issue-5551
ISSUE: 5551 ISSUE: 5551
TITLE: Crash when attempt to create database with running trace ( internal Firebird TITLE: Attempt to create database with running trace leads to consistency check (cannot find tip page (165), file: tra.cpp line: 2233)
consistency check (cannot find tip page (165), file: tra.cpp line: 2233) )
DESCRIPTION: DESCRIPTION:
1. Get the content of firebird.log before test. 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. 2. Make config file and launch trace session, with separate logging of its STDOUT and STDERR.
@ -43,6 +42,7 @@ trace = ['time_threshold = 0',
'max_log_size = 5000000', 'max_log_size = 5000000',
] ]
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, temp_db: Path): def test_1(act: Action, temp_db: Path):
sql_ddl = f""" sql_ddl = f"""

View File

@ -3,8 +3,7 @@
""" """
ID: issue-5606 ID: issue-5606
ISSUE: 5606 ISSUE: 5606
TITLE: Trace session leads FB 4.0 to hang after 2nd launch of trivial .sql script. TITLE: Trace session leads FB 4.0 to hang after 2nd launch of trivial .sql script. Neither attach to any database nor regular restart of FB service can be done.
Neither attach to any database nor regular restart of FB service can be done.
DESCRIPTION: DESCRIPTION:
Ticket issue was reproduced on trivial trace config with single line ("enabled = true"). Ticket issue was reproduced on trivial trace config with single line ("enabled = true").
We prepare such config, launch trace session in async mode and run THREE times isql with logging its output. We prepare such config, launch trace session in async mode and run THREE times isql with logging its output.
@ -87,6 +86,7 @@ trace = ['database=',
'}'] '}']
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(config=trace, keep_log=False): with act.trace(config=trace, keep_log=False):

View File

@ -95,6 +95,7 @@ trace = ['time_threshold = 0',
'log_statement_finish = true', 'log_statement_finish = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.2') @pytest.mark.version('>=3.0.2')
def test_1(act: Action): def test_1(act: Action):
act.isql(switches=[], input=async_init_script) act.isql(switches=[], input=async_init_script)

View File

@ -64,6 +64,7 @@ trace = ['time_threshold = 0',
'include_filter = "%(select % from test where x = ?)%"', 'include_filter = "%(select % from test where x = ?)%"',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.2') @pytest.mark.version('>=3.0.2')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace), act.db.connect() as con: with act.trace(db_events=trace), act.db.connect() as con:

View File

@ -77,6 +77,7 @@ expected_stderr_isql = """
expected_stdout_trace = test_sql.replace('set list on;', '').replace(';','') expected_stdout_trace = test_sql.replace('set list on;', '').replace(';','')
@pytest.mark.trace
@pytest.mark.version('>=3.0.6') @pytest.mark.version('>=3.0.6')
@pytest.mark.platform('Windows') @pytest.mark.platform('Windows')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -98,6 +98,7 @@ expected_trace_log = """
rdb$database /* ddl_3 line_8 */ rdb$database /* ddl_3 line_8 */
""" """
@pytest.mark.trace
@pytest.mark.version('>=3.0.2') @pytest.mark.version('>=3.0.2')
def test_1(act: Action, tmp_file: Path, capsys): def test_1(act: Action, tmp_file: Path, capsys):
with act.trace(db_events=trace), act.db.connect() as con: with act.trace(db_events=trace), act.db.connect() as con:

View File

@ -107,6 +107,7 @@ trace = ['time_threshold = 0',
# 2) 335544913 : value exceeds the range for valid timestamps # 2) 335544913 : value exceeds the range for valid timestamps
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(db_events=trace): with act.trace(db_events=trace):

View File

@ -42,6 +42,7 @@ trace = ['time_threshold = 0',
'log_statement_finish = true', 'log_statement_finish = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.2') @pytest.mark.version('>=3.0.2')
@pytest.mark.platform('Windows') @pytest.mark.platform('Windows')
def test_1(act: Action, tmp_file: Path, capsys): def test_1(act: Action, tmp_file: Path, capsys):

View File

@ -86,6 +86,7 @@ trace = ['time_threshold = 0',
'log_statement_finish = true', 'log_statement_finish = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
trace_dts_pattern = re.compile('.*(ATTACH_DATABASE|START_TRANSACTION|EXECUTE_STATEMENT_FINISH|ROLLBACK_TRANSACTION|DETACH_DATABASE)') trace_dts_pattern = re.compile('.*(ATTACH_DATABASE|START_TRANSACTION|EXECUTE_STATEMENT_FINISH|ROLLBACK_TRANSACTION|DETACH_DATABASE)')

View File

@ -93,6 +93,7 @@ trace = ['time_threshold = 0',
'log_initfini = false', 'log_initfini = false',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.2') @pytest.mark.version('>=3.0.2')
def test_1(act: Action): def test_1(act: Action):

View File

@ -57,6 +57,7 @@ database =
} }
""" """
@pytest.mark.trace
@pytest.mark.version('>=3.0.3') @pytest.mark.version('>=3.0.3')
def test_1(act: Action): def test_1(act: Action):
log_before = act.get_firebird_log() log_before = act.get_firebird_log()

View File

@ -42,6 +42,7 @@ trace_conf = ['database=(%[\\\\/](\\{{core_5907.[[:DIGIT:]]{{2}}\\}}).fdb)',
'}' '}'
] ]
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
with act.trace(config=trace_conf): with act.trace(config=trace_conf):

View File

@ -95,6 +95,7 @@ trace = ['{',
'}' '}'
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.5') @pytest.mark.version('>=3.0.5')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
trace.insert(0, f"database = '{act.db.db_path}'") trace.insert(0, f"database = '{act.db.db_path}'")

View File

@ -25,6 +25,7 @@ trace = ['log_initfini = false',
'log_statement_finish = true', 'log_statement_finish = true',
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.5') @pytest.mark.version('>=3.0.5')
def test_1(act: Action): def test_1(act: Action):
with act.trace(db_events=trace), act.connect_server() as srv: with act.trace(db_events=trace), act.connect_server() as srv:

View File

@ -61,6 +61,7 @@ allowed_patterns = [
,re.compile('\\s*New\\s+number\\s+\\d+\\s*', re.IGNORECASE) ,re.compile('\\s*New\\s+number\\s+\\d+\\s*', re.IGNORECASE)
] ]
@pytest.mark.trace
@pytest.mark.version('>=3.0.6') @pytest.mark.version('>=3.0.6')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -63,6 +63,7 @@ trace = """
trace_conf = temp_file('trace.conf') trace_conf = temp_file('trace.conf')
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, db_nonexistent: Database, trace_conf: Path, capsys): def test_1(act: Action, db_nonexistent: Database, trace_conf: Path, capsys):
with ServerKeeper(act, None): # Use embedded server for trace with ServerKeeper(act, None): # Use embedded server for trace

View File

@ -184,6 +184,7 @@ def run_script(act: Action, tmp_file: Path):
act.isql(switches=['-n', '-q'], input_file = tmp_file, connect_db = False, credentials = False) act.isql(switches=['-n', '-q'], input_file = tmp_file, connect_db = False, credentials = False)
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
@pytest.mark.platform('Windows') @pytest.mark.platform('Windows')
def test_1(act: Action, test_role: Role, tmp_file: Path, capsys): def test_1(act: Action, test_role: Role, tmp_file: Path, capsys):

View File

@ -61,6 +61,7 @@ expected_stdout_trace = f"""
""" """
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):
trace_cfg_items = [ trace_cfg_items = [

View File

@ -167,6 +167,7 @@ expected_stdout_trace = """
FOUND line with execution statistics FOUND line with execution statistics
""" """
@pytest.mark.trace
@pytest.mark.version('>=3.0.8') @pytest.mark.version('>=3.0.8')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -65,6 +65,7 @@ def get_external_trace_id(act: Action, a_what_to_check, a_ext_trace_session_name
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys): def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys):

View File

@ -53,6 +53,7 @@ expected_stderr_isql = """
Missing security context for TEST.FDB Missing security context for TEST.FDB
""" """
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
@pytest.mark.platform('Windows') @pytest.mark.platform('Windows')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -271,6 +271,7 @@ commit
0 records fetched 0 records fetched
""" """
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -41,6 +41,7 @@ trace = ['log_initfini = false',
allowed_patterns = [ ' ERROR AT ', 'Trigger TRG_ANY_DDL_STATEMENT_', ] allowed_patterns = [ ' ERROR AT ', 'Trigger TRG_ANY_DDL_STATEMENT_', ]
allowed_patterns = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns] allowed_patterns = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns]
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -73,6 +73,7 @@ def replace_leading(source, char="."):
stripped = source.lstrip() stripped = source.lstrip()
return char * (len(source) - len(stripped)) + stripped return char * (len(source) - len(stripped)) + stripped
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -64,6 +64,7 @@ trace = ['log_initfini = false',
allowed_patterns = [ ' ERROR AT ', 'Trigger TRG_', 'Procedure (SP_TEST|PG_TEST.PG_SP_WORKER)', 'Function (FN_TEST|PG_TEST.PG_FN_WORKER)' ] allowed_patterns = [ ' ERROR AT ', 'Trigger TRG_', 'Procedure (SP_TEST|PG_TEST.PG_SP_WORKER)', 'Function (FN_TEST|PG_TEST.PG_FN_WORKER)' ]
allowed_patterns = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns] allowed_patterns = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns]
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action, capsys): def test_1(act: Action, capsys):

View File

@ -35,6 +35,7 @@ substitutions = [('^((?!SQLSTATE|(I/O error)|(Error while)|335544344|335544734).
act = python_act('db', substitutions = substitutions) act = python_act('db', substitutions = substitutions)
act_non_existing_database = python_act('db_non_existing_database') act_non_existing_database = python_act('db_non_existing_database')
@pytest.mark.trace
@pytest.mark.version('>=4.0.3') @pytest.mark.version('>=4.0.3')
def test_1(act: Action, act_non_existing_database: Action, tmp_user: User, tmp_role: Role, tmp_usr2: User, capsys): def test_1(act: Action, act_non_existing_database: Action, tmp_user: User, tmp_role: Role, tmp_usr2: User, capsys):

View File

@ -0,0 +1,81 @@
#coding:utf-8
"""
ID: issue-5740-A
ISSUE: 5740-A
TITLE: Trace INCLUDE_FILTER with [[:WHITESPACE:]]+ does not work when statement contains newline is issued
DESCRIPTION:
We create a list of several DDLs which all contain NEWLINE character(s) between keyword and name of DB object.
Then we launch trace session and execute all these DDLs.
Finally we check whether trace log contains every DDL or not.
Expected result: text of every DDL should be FOUND in the trace log.
JIRA: CORE-5470
FBTEST: bugs.core_5470
"""
import pytest
from firebird.qa import *
db = db_factory()
act = python_act('db')
ddl_lst = ["""recreate /* ddl_1 line_1 */
table /* ddl_1 line_2 */
t_test /* ddl_1 line_3 */ (x int)
""",
"""comment on /* ddl_2 line_1 */
table /* ddl_2 line_2 */
t_test is /* ddl_2 line_3 */
'foo /* ddl_2 line_4 */
/* ddl_2 line_4 */ bar'
""",
"""
create /* ddl_3 line_1 */
or /* ddl_3 line_2 */
alter /* ddl_3 line_3 */
view /* ddl_3 line_4 */
v_rio /* ddl_3 line_5 */
as /* ddl_3 line_6 */
select * /* ddl_3 line_6 */
from /* ddl_3 line_7 */
rdb$database /* ddl_3 line_8 */
"""]
trace = ['time_threshold = 0',
'log_initfini = false',
'log_errors = true',
'log_statement_finish = true',
#'include_filter = "%(recreate|create|alter|drop|comment on)[[:WHITESPACE:]]+(domain|generator|sequence|exception|procedure|function|table|index|view|trigger|role|filter|external function)%"',
'include_filter = "%(ddl_[[:DIGIT:]]+[[:WHITESPACE:]]+line_[[:DIGIT:]]+)%"',
]
@pytest.mark.trace
@pytest.mark.version('>=3')
def test_1(act: Action, capsys):
with act.trace(db_events=trace), act.db.connect() as con:
for cmd in ddl_lst:
con.execute_immediate(cmd)
con.commit()
#print(act.trace_to_stdout())
print(act.trace_log)
act.expected_stdout = '' # expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout
# Check
#act.trace_to_stdout()
#for cmd in ddl_lst:
# assert act.stdout.find(cmd) > 0

View File

@ -0,0 +1,81 @@
#coding:utf-8
"""
ID: issue-5740-A
ISSUE: 5740-A
TITLE: Trace INCLUDE_FILTER with [[:WHITESPACE:]]+ does not work when statement contains newline is issued
DESCRIPTION:
We create a list of several DDLs which all contain NEWLINE character(s) between keyword and name of DB object.
Then we launch trace session and execute all these DDLs.
Finally we check whether trace log contains every DDL or not.
Expected result: text of every DDL should be FOUND in the trace log.
JIRA: CORE-5470
FBTEST: bugs.core_5470
"""
import pytest
from firebird.qa import *
db = db_factory()
act = python_act('db')
ddl_lst = ["""recreate /* ddl_1 line_1 */
table /* ddl_1 line_2 */
t_test /* ddl_1 line_3 */ (x int)
""",
"""comment on /* ddl_2 line_1 */
table /* ddl_2 line_2 */
t_test is /* ddl_2 line_3 */
'foo /* ddl_2 line_4 */
/* ddl_2 line_4 */ bar'
""",
"""
create /* ddl_3 line_1 */
or /* ddl_3 line_2 */
alter /* ddl_3 line_3 */
view /* ddl_3 line_4 */
v_rio /* ddl_3 line_5 */
as /* ddl_3 line_6 */
select * /* ddl_3 line_6 */
from /* ddl_3 line_7 */
rdb$database /* ddl_3 line_8 */
"""]
trace = ['time_threshold = 0',
'log_initfini = false',
'log_errors = true',
'log_statement_finish = true',
#'include_filter = "%(recreate|create|alter|drop|comment on)[[:WHITESPACE:]]+(domain|generator|sequence|exception|procedure|function|table|index|view|trigger|role|filter|external function)%"',
'include_filter = "%(ddl_[[:DIGIT:]]+[[:WHITESPACE:]]+line_[[:DIGIT:]]+)%"',
]
@pytest.mark.trace
@pytest.mark.version('>=3')
def test_1(act: Action, capsys):
with act.trace(db_events=trace), act.db.connect() as con:
for cmd in ddl_lst:
con.execute_immediate(cmd)
con.commit()
#print(act.trace_to_stdout())
print(act.trace_log)
act.expected_stdout = '' # expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout
# Check
#act.trace_to_stdout()
#for cmd in ddl_lst:
# assert act.stdout.find(cmd) > 0

View File

@ -43,6 +43,7 @@ act = python_act('db')
#expected_stdout = 'SUCCESS: found expected line format in the trace log: <USER>:<ROLE>' #expected_stdout = 'SUCCESS: found expected line format in the trace log: <USER>:<ROLE>'
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, tmp_user: User, tmp_role:Role, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys): def test_1(act: Action, tmp_user: User, tmp_role:Role, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys):

View File

@ -29,6 +29,7 @@ tmp_usr2 = user_factory('db', name='tmp_stock_manager', password='123')
act = python_act('db') act = python_act('db')
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, tmp_user: User, tmp_role: Role, tmp_usr2: User, capsys): def test_1(act: Action, tmp_user: User, tmp_role: Role, tmp_usr2: User, capsys):

View File

@ -213,6 +213,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.3') @pytest.mark.version('>=4.0.3')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -203,6 +203,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.3') @pytest.mark.version('>=4.0.3')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -172,6 +172,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -166,6 +166,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):

View File

@ -234,6 +234,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -224,6 +224,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -244,6 +244,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -225,6 +225,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -216,6 +216,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -270,6 +270,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -216,6 +216,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -238,6 +238,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -216,6 +216,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -221,6 +221,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -225,6 +225,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0.2') @pytest.mark.version('>=4.0.2')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -223,6 +223,7 @@ def wait_for_record_become_locked(tx_monitoring, cur_monitoring, sql_to_lock_rec
#----------------------------------------------------------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------------------------------
@pytest.mark.trace
@pytest.mark.version('>=4.0') @pytest.mark.version('>=4.0')
def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys):
sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text() sql_init = (act.files_dir / 'read-consist-sttm-restart-DDL.sql').read_text()

View File

@ -71,6 +71,7 @@ substitutions = [ ('.* FAILED EXECUTE_TRIGGER_FINISH', 'FAILED EXECUTE_TRIGGER_F
act = python_act('db', substitutions = substitutions) act = python_act('db', substitutions = substitutions)
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action, tmp_worker: User, capsys): def test_1(act: Action, tmp_worker: User, capsys):

View File

@ -44,6 +44,7 @@ substitutions = [ ('.* FAILED EXECUTE_TRIGGER_FINISH', 'FAILED EXECUTE_TRIGGER_F
act = python_act('db', substitutions = substitutions) act = python_act('db', substitutions = substitutions)
@pytest.mark.trace
@pytest.mark.version('>=5.0') @pytest.mark.version('>=5.0')
def test_1(act: Action, tmp_worker: User, capsys): def test_1(act: Action, tmp_worker: User, capsys):