From 40741bd449ed1a03a3010401d85590cee54648a9 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Wed, 15 May 2024 20:26:01 +0300 Subject: [PATCH] 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. --- tests/bugs/core_2940_test.py | 1 + tests/bugs/core_2981_test.py | 1 + tests/bugs/core_3008_test.py | 1 + tests/bugs/core_3168_test.py | 1 + tests/bugs/core_3413_test.py | 1 + tests/bugs/core_3537_test.py | 1 + tests/bugs/core_3598_test.py | 1 + tests/bugs/core_3658_test.py | 1 + tests/bugs/core_3884_test.py | 1 + tests/bugs/core_3934_test.py | 1 + tests/bugs/core_4094_test.py | 1 + tests/bugs/core_4135_test.py | 1 + tests/bugs/core_4319_test.py | 2 + tests/bugs/core_4337_test.py | 1 + tests/bugs/core_4345_test.py | 1 + tests/bugs/core_4451_test.py | 1 + tests/bugs/core_4889_test.py | 1 + tests/bugs/core_4927_test.py | 1 + tests/bugs/core_5269_test.py | 1 + tests/bugs/core_5273_test.py | 4 +- tests/bugs/core_5330_test.py | 4 +- tests/bugs/core_5435_test.py | 1 + tests/bugs/core_5441_test.py | 1 + tests/bugs/core_5470_addi_test.py | 1 + tests/bugs/core_5470_test.py | 1 + tests/bugs/core_5475_test.py | 1 + tests/bugs/core_5477_test.py | 1 + tests/bugs/core_5488_session_idle_test.py | 1 + tests/bugs/core_5489_test.py | 1 + tests/bugs/core_5706_test.py | 1 + tests/bugs/core_5907_test.py | 1 + tests/bugs/core_5991_test.py | 1 + tests/bugs/core_5995_test.py | 1 + tests/bugs/core_6095_test.py | 1 + tests/bugs/core_6272_test.py | 1 + tests/bugs/core_6469_test.py | 1 + tests/bugs/gh_3106_test.py | 1 + tests/bugs/gh_6782_test.py | 1 + tests/bugs/gh_7139_test.py | 1 + tests/bugs/gh_7165_test.py | 1 + tests/bugs/gh_7208_test.py | 1 + tests/bugs/gh_7426_test.py | 1 + tests/bugs/gh_7466_plans_tracking_test.py | 1 + tests/bugs/gh_7466_test.py | 1 + tests/bugs/gh_7558_test.py | 1 + tests/bugs/test_trace_eol.py | 81 +++++++++++++++++++ tests/bugs/test_trace_eol_cr_space_nl.py | 81 +++++++++++++++++++ .../test_role_in_service_attachment.py | 1 + .../syspriv/test_trace_any_attachment.py | 1 + ...read_consist_statement_delete_undone_01.py | 1 + ...read_consist_statement_delete_undone_02.py | 1 + ...onsist_sttm_merge_deny_multiple_matches.py | 1 + ...est_read_consist_sttm_restart_max_limit.py | 1 + ..._read_consist_sttm_restart_on_delete_01.py | 1 + ..._read_consist_sttm_restart_on_delete_02.py | 1 + ..._read_consist_sttm_restart_on_delete_03.py | 1 + ..._read_consist_sttm_restart_on_delete_04.py | 1 + ...t_read_consist_sttm_restart_on_merge_01.py | 1 + ...t_read_consist_sttm_restart_on_merge_02.py | 1 + ...t_read_consist_sttm_restart_on_merge_03.py | 1 + ...t_read_consist_sttm_restart_on_merge_04.py | 1 + ..._read_consist_sttm_restart_on_update_01.py | 1 + ..._read_consist_sttm_restart_on_update_02.py | 1 + ..._read_consist_sttm_restart_on_update_03.py | 1 + ..._read_consist_sttm_restart_on_update_04.py | 1 + .../trigger/database/test_disconnect_05.py | 1 + .../trigger/database/test_disconnect_06.py | 1 + 67 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 tests/bugs/test_trace_eol.py create mode 100644 tests/bugs/test_trace_eol_cr_space_nl.py diff --git a/tests/bugs/core_2940_test.py b/tests/bugs/core_2940_test.py index 110f6521..b204ba4d 100644 --- a/tests/bugs/core_2940_test.py +++ b/tests/bugs/core_2940_test.py @@ -69,6 +69,7 @@ trace = [ ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action): with act.trace(db_events=trace): diff --git a/tests/bugs/core_2981_test.py b/tests/bugs/core_2981_test.py index c8ad0936..fe0b2406 100644 --- a/tests/bugs/core_2981_test.py +++ b/tests/bugs/core_2981_test.py @@ -127,6 +127,7 @@ trace = ['include_filter = %(SELECT|INSERT|UPDATE|DELETE)%', 'max_arg_count = 30', ] +@pytest.mark.trace @pytest.mark.version('>=3') def test_1(act: Action): # Get content of firebird.log BEFORE test diff --git a/tests/bugs/core_3008_test.py b/tests/bugs/core_3008_test.py index f78f1580..7d328982 100644 --- a/tests/bugs/core_3008_test.py +++ b/tests/bugs/core_3008_test.py @@ -28,6 +28,7 @@ trace = ['log_connections = true', 'time_threshold = 0', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action): with act.trace(db_events=trace): diff --git a/tests/bugs/core_3168_test.py b/tests/bugs/core_3168_test.py index 126fdc59..eee22ae4 100644 --- a/tests/bugs/core_3168_test.py +++ b/tests/bugs/core_3168_test.py @@ -29,6 +29,7 @@ trace = ['log_services = true', temp_file = temp_file('test-file') +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, temp_file): with act.trace(svc_events=trace), act.connect_server() as srv: diff --git a/tests/bugs/core_3413_test.py b/tests/bugs/core_3413_test.py index fccab271..eb44ee6b 100644 --- a/tests/bugs/core_3413_test.py +++ b/tests/bugs/core_3413_test.py @@ -30,6 +30,7 @@ trace = ['time_threshold = 0', 'log_statement_finish = foo' ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action): with act.trace(db_events=trace): diff --git a/tests/bugs/core_3537_test.py b/tests/bugs/core_3537_test.py index d19f7f19..21d89384 100644 --- a/tests/bugs/core_3537_test.py +++ b/tests/bugs/core_3537_test.py @@ -136,6 +136,7 @@ trace = ['log_transactions = true', 'log_initfini = false', ] +@pytest.mark.trace @pytest.mark.version('>=3') def test_1(act: Action, capsys): NUM_ROWS_TO_BE_ADDED = 45000 diff --git a/tests/bugs/core_3598_test.py b/tests/bugs/core_3598_test.py index c0648e8b..a1a32f89 100644 --- a/tests/bugs/core_3598_test.py +++ b/tests/bugs/core_3598_test.py @@ -83,6 +83,7 @@ trace = ['log_transactions = true', 'log_initfini = false', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): expected_stdout = '' diff --git a/tests/bugs/core_3658_test.py b/tests/bugs/core_3658_test.py index 033aa60d..f6097e0d 100644 --- a/tests/bugs/core_3658_test.py +++ b/tests/bugs/core_3658_test.py @@ -41,6 +41,7 @@ svc_items = [ 'log_errors = true', ] +@pytest.mark.trace @pytest.mark.version('>=3') def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys): #print( os.environ.get('ISC_USER', 'UNKNOWN_ISC_USR') ) diff --git a/tests/bugs/core_3884_test.py b/tests/bugs/core_3884_test.py index d25b6364..ae06320f 100644 --- a/tests/bugs/core_3884_test.py +++ b/tests/bugs/core_3884_test.py @@ -44,6 +44,7 @@ expected_stdout_isql = """ -At block line: 3, col: 13 """ +@pytest.mark.trace @pytest.mark.version('>=3') def test_1(act: Action, capsys): diff --git a/tests/bugs/core_3934_test.py b/tests/bugs/core_3934_test.py index 7f14f311..c7753d0a 100644 --- a/tests/bugs/core_3934_test.py +++ b/tests/bugs/core_3934_test.py @@ -38,6 +38,7 @@ def check_sweep(act: Action, log_sweep: bool): with act.trace(db_events=cfg), act.connect_server() as srv: srv.database.sweep(database=act.db.db_path) +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action): # Case 1 - sweep logged diff --git a/tests/bugs/core_4094_test.py b/tests/bugs/core_4094_test.py index 55f84143..9e9d014b 100644 --- a/tests/bugs/core_4094_test.py +++ b/tests/bugs/core_4094_test.py @@ -72,6 +72,7 @@ trace = ['time_threshold = 0', 'log_statement_start = true', ] +@pytest.mark.trace @pytest.mark.version('>=3') def test_1(act: Action, capsys): with act.trace(db_events=trace): diff --git a/tests/bugs/core_4135_test.py b/tests/bugs/core_4135_test.py index 7511d760..0a0b4f4f 100644 --- a/tests/bugs/core_4135_test.py +++ b/tests/bugs/core_4135_test.py @@ -66,6 +66,7 @@ trace = ['time_threshold = 0', 'log_trigger_finish = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): # How many rows must be inserted to the test table: diff --git a/tests/bugs/core_4319_test.py b/tests/bugs/core_4319_test.py index a29e4e5e..f8c228b9 100644 --- a/tests/bugs/core_4319_test.py +++ b/tests/bugs/core_4319_test.py @@ -52,6 +52,8 @@ trace_conf = """ """.split('\n') NO_SUCH_ALIAS = 'n0_$uch_f1le' + +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): diff --git a/tests/bugs/core_4337_test.py b/tests/bugs/core_4337_test.py index f2e382bc..964308d7 100644 --- a/tests/bugs/core_4337_test.py +++ b/tests/bugs/core_4337_test.py @@ -133,6 +133,7 @@ trace = ['time_threshold = 0', 'log_connections = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, sweep_log: Path, capsys): diff --git a/tests/bugs/core_4345_test.py b/tests/bugs/core_4345_test.py index e91a93ed..3a324582 100644 --- a/tests/bugs/core_4345_test.py +++ b/tests/bugs/core_4345_test.py @@ -74,6 +74,7 @@ trace = ['time_threshold = 0', 'log_function_finish = true' ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action): output = [] diff --git a/tests/bugs/core_4451_test.py b/tests/bugs/core_4451_test.py index 852e63bc..d3ab4a2b 100644 --- a/tests/bugs/core_4451_test.py +++ b/tests/bugs/core_4451_test.py @@ -34,6 +34,7 @@ trace = ['time_threshold = 0', 'include_filter=%(from|join)[[:whitespace:]]test%', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): with act.trace(db_events=trace): diff --git a/tests/bugs/core_4889_test.py b/tests/bugs/core_4889_test.py index 8cc7dfd0..c1d0d5bf 100644 --- a/tests/bugs/core_4889_test.py +++ b/tests/bugs/core_4889_test.py @@ -54,6 +54,7 @@ trace = [ 'log_errors = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): with act.trace(db_events=trace): diff --git a/tests/bugs/core_4927_test.py b/tests/bugs/core_4927_test.py index 58a60437..d40e7173 100644 --- a/tests/bugs/core_4927_test.py +++ b/tests/bugs/core_4927_test.py @@ -99,6 +99,7 @@ trace = ['time_threshold = 0', 'print_perf = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): with act.trace(db_events=trace): diff --git a/tests/bugs/core_5269_test.py b/tests/bugs/core_5269_test.py index 1256aa86..e85839cc 100644 --- a/tests/bugs/core_5269_test.py +++ b/tests/bugs/core_5269_test.py @@ -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'); """ +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, user_a: User, user_b: User, test_role: Role): with act.db.connect() as con: diff --git a/tests/bugs/core_5273_test.py b/tests/bugs/core_5273_test.py index 8855229b..f51a59e7 100644 --- a/tests/bugs/core_5273_test.py +++ b/tests/bugs/core_5273_test.py @@ -3,8 +3,7 @@ """ 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) ) +TITLE: Attempt to create database with running trace leads to consistency check (cannot find tip page (165), file: tra.cpp line: 2233) 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. @@ -43,6 +42,7 @@ trace = ['time_threshold = 0', 'max_log_size = 5000000', ] +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, temp_db: Path): sql_ddl = f""" diff --git a/tests/bugs/core_5330_test.py b/tests/bugs/core_5330_test.py index d5c370ca..89a52ab1 100644 --- a/tests/bugs/core_5330_test.py +++ b/tests/bugs/core_5330_test.py @@ -3,8 +3,7 @@ """ ID: issue-5606 ISSUE: 5606 -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. +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. DESCRIPTION: 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. @@ -87,6 +86,7 @@ trace = ['database=', '}'] +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, capsys): with act.trace(config=trace, keep_log=False): diff --git a/tests/bugs/core_5435_test.py b/tests/bugs/core_5435_test.py index 88de6dff..e449df69 100644 --- a/tests/bugs/core_5435_test.py +++ b/tests/bugs/core_5435_test.py @@ -95,6 +95,7 @@ trace = ['time_threshold = 0', 'log_statement_finish = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0.2') def test_1(act: Action): act.isql(switches=[], input=async_init_script) diff --git a/tests/bugs/core_5441_test.py b/tests/bugs/core_5441_test.py index 88332365..7133e8e9 100644 --- a/tests/bugs/core_5441_test.py +++ b/tests/bugs/core_5441_test.py @@ -64,6 +64,7 @@ trace = ['time_threshold = 0', 'include_filter = "%(select % from test where x = ?)%"', ] +@pytest.mark.trace @pytest.mark.version('>=3.0.2') def test_1(act: Action, capsys): with act.trace(db_events=trace), act.db.connect() as con: diff --git a/tests/bugs/core_5470_addi_test.py b/tests/bugs/core_5470_addi_test.py index 1c12a711..78a4568c 100644 --- a/tests/bugs/core_5470_addi_test.py +++ b/tests/bugs/core_5470_addi_test.py @@ -77,6 +77,7 @@ expected_stderr_isql = """ expected_stdout_trace = test_sql.replace('set list on;', '').replace(';','') +@pytest.mark.trace @pytest.mark.version('>=3.0.6') @pytest.mark.platform('Windows') def test_1(act: Action, capsys): diff --git a/tests/bugs/core_5470_test.py b/tests/bugs/core_5470_test.py index 0c9012d3..7d611d3f 100644 --- a/tests/bugs/core_5470_test.py +++ b/tests/bugs/core_5470_test.py @@ -98,6 +98,7 @@ expected_trace_log = """ rdb$database /* ddl_3 line_8 */ """ +@pytest.mark.trace @pytest.mark.version('>=3.0.2') def test_1(act: Action, tmp_file: Path, capsys): with act.trace(db_events=trace), act.db.connect() as con: diff --git a/tests/bugs/core_5475_test.py b/tests/bugs/core_5475_test.py index fff8b6f7..f94e0387 100644 --- a/tests/bugs/core_5475_test.py +++ b/tests/bugs/core_5475_test.py @@ -107,6 +107,7 @@ trace = ['time_threshold = 0', # 2) 335544913 : value exceeds the range for valid timestamps ] +@pytest.mark.trace @pytest.mark.version('>=3.0') def test_1(act: Action, capsys): with act.trace(db_events=trace): diff --git a/tests/bugs/core_5477_test.py b/tests/bugs/core_5477_test.py index 913ca35a..3c964d45 100644 --- a/tests/bugs/core_5477_test.py +++ b/tests/bugs/core_5477_test.py @@ -42,6 +42,7 @@ trace = ['time_threshold = 0', 'log_statement_finish = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0.2') @pytest.mark.platform('Windows') def test_1(act: Action, tmp_file: Path, capsys): diff --git a/tests/bugs/core_5488_session_idle_test.py b/tests/bugs/core_5488_session_idle_test.py index 997595e1..532fa0fd 100644 --- a/tests/bugs/core_5488_session_idle_test.py +++ b/tests/bugs/core_5488_session_idle_test.py @@ -86,6 +86,7 @@ trace = ['time_threshold = 0', 'log_statement_finish = true', ] +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, capsys): trace_dts_pattern = re.compile('.*(ATTACH_DATABASE|START_TRANSACTION|EXECUTE_STATEMENT_FINISH|ROLLBACK_TRANSACTION|DETACH_DATABASE)') diff --git a/tests/bugs/core_5489_test.py b/tests/bugs/core_5489_test.py index edeff15a..a1c845be 100644 --- a/tests/bugs/core_5489_test.py +++ b/tests/bugs/core_5489_test.py @@ -93,6 +93,7 @@ trace = ['time_threshold = 0', 'log_initfini = false', ] +@pytest.mark.trace @pytest.mark.version('>=3.0.2') def test_1(act: Action): diff --git a/tests/bugs/core_5706_test.py b/tests/bugs/core_5706_test.py index 620dc3c9..95889640 100644 --- a/tests/bugs/core_5706_test.py +++ b/tests/bugs/core_5706_test.py @@ -57,6 +57,7 @@ database = } """ +@pytest.mark.trace @pytest.mark.version('>=3.0.3') def test_1(act: Action): log_before = act.get_firebird_log() diff --git a/tests/bugs/core_5907_test.py b/tests/bugs/core_5907_test.py index 0fa2091f..e3f19380 100644 --- a/tests/bugs/core_5907_test.py +++ b/tests/bugs/core_5907_test.py @@ -42,6 +42,7 @@ trace_conf = ['database=(%[\\\\/](\\{{core_5907.[[:DIGIT:]]{{2}}\\}}).fdb)', '}' ] +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, capsys): with act.trace(config=trace_conf): diff --git a/tests/bugs/core_5991_test.py b/tests/bugs/core_5991_test.py index fc8719ca..19cf7836 100644 --- a/tests/bugs/core_5991_test.py +++ b/tests/bugs/core_5991_test.py @@ -95,6 +95,7 @@ trace = ['{', '}' ] +@pytest.mark.trace @pytest.mark.version('>=3.0.5') def test_1(act: Action, capsys): trace.insert(0, f"database = '{act.db.db_path}'") diff --git a/tests/bugs/core_5995_test.py b/tests/bugs/core_5995_test.py index c157c1cb..af374076 100644 --- a/tests/bugs/core_5995_test.py +++ b/tests/bugs/core_5995_test.py @@ -25,6 +25,7 @@ trace = ['log_initfini = false', 'log_statement_finish = true', ] +@pytest.mark.trace @pytest.mark.version('>=3.0.5') def test_1(act: Action): with act.trace(db_events=trace), act.connect_server() as srv: diff --git a/tests/bugs/core_6095_test.py b/tests/bugs/core_6095_test.py index c7f4282e..26a96220 100644 --- a/tests/bugs/core_6095_test.py +++ b/tests/bugs/core_6095_test.py @@ -61,6 +61,7 @@ allowed_patterns = [ ,re.compile('\\s*New\\s+number\\s+\\d+\\s*', re.IGNORECASE) ] +@pytest.mark.trace @pytest.mark.version('>=3.0.6') def test_1(act: Action, capsys): diff --git a/tests/bugs/core_6272_test.py b/tests/bugs/core_6272_test.py index 789dbff6..9ca82e35 100644 --- a/tests/bugs/core_6272_test.py +++ b/tests/bugs/core_6272_test.py @@ -63,6 +63,7 @@ trace = """ trace_conf = temp_file('trace.conf') +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, db_nonexistent: Database, trace_conf: Path, capsys): with ServerKeeper(act, None): # Use embedded server for trace diff --git a/tests/bugs/core_6469_test.py b/tests/bugs/core_6469_test.py index 13977076..20d75618 100644 --- a/tests/bugs/core_6469_test.py +++ b/tests/bugs/core_6469_test.py @@ -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) +@pytest.mark.trace @pytest.mark.version('>=4.0') @pytest.mark.platform('Windows') def test_1(act: Action, test_role: Role, tmp_file: Path, capsys): diff --git a/tests/bugs/gh_3106_test.py b/tests/bugs/gh_3106_test.py index 624c2eac..77810f46 100644 --- a/tests/bugs/gh_3106_test.py +++ b/tests/bugs/gh_3106_test.py @@ -61,6 +61,7 @@ expected_stdout_trace = f""" """ +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, capsys): trace_cfg_items = [ diff --git a/tests/bugs/gh_6782_test.py b/tests/bugs/gh_6782_test.py index 976a40de..cc7921e6 100644 --- a/tests/bugs/gh_6782_test.py +++ b/tests/bugs/gh_6782_test.py @@ -167,6 +167,7 @@ expected_stdout_trace = """ FOUND line with execution statistics """ +@pytest.mark.trace @pytest.mark.version('>=3.0.8') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7139_test.py b/tests/bugs/gh_7139_test.py index 40d5fa78..f77564f0 100644 --- a/tests/bugs/gh_7139_test.py +++ b/tests/bugs/gh_7139_test.py @@ -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') def test_1(act: Action, tmp_trace_cfg: Path, tmp_trace_log: Path, capsys): diff --git a/tests/bugs/gh_7165_test.py b/tests/bugs/gh_7165_test.py index 6f403737..2624576a 100644 --- a/tests/bugs/gh_7165_test.py +++ b/tests/bugs/gh_7165_test.py @@ -53,6 +53,7 @@ expected_stderr_isql = """ Missing security context for TEST.FDB """ +@pytest.mark.trace @pytest.mark.version('>=5.0') @pytest.mark.platform('Windows') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7208_test.py b/tests/bugs/gh_7208_test.py index b91a8377..534ff933 100644 --- a/tests/bugs/gh_7208_test.py +++ b/tests/bugs/gh_7208_test.py @@ -271,6 +271,7 @@ commit 0 records fetched """ +@pytest.mark.trace @pytest.mark.version('>=4.0.2') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7426_test.py b/tests/bugs/gh_7426_test.py index e073a9eb..c4338dbe 100644 --- a/tests/bugs/gh_7426_test.py +++ b/tests/bugs/gh_7426_test.py @@ -41,6 +41,7 @@ trace = ['log_initfini = false', allowed_patterns = [ ' ERROR AT ', 'Trigger TRG_ANY_DDL_STATEMENT_', ] allowed_patterns = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns] +@pytest.mark.trace @pytest.mark.version('>=5.0') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7466_plans_tracking_test.py b/tests/bugs/gh_7466_plans_tracking_test.py index 46d9a830..a745649c 100644 --- a/tests/bugs/gh_7466_plans_tracking_test.py +++ b/tests/bugs/gh_7466_plans_tracking_test.py @@ -73,6 +73,7 @@ def replace_leading(source, char="."): stripped = source.lstrip() return char * (len(source) - len(stripped)) + stripped +@pytest.mark.trace @pytest.mark.version('>=5.0') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7466_test.py b/tests/bugs/gh_7466_test.py index 641a788d..df8b51a2 100644 --- a/tests/bugs/gh_7466_test.py +++ b/tests/bugs/gh_7466_test.py @@ -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 = [ re.compile(r, re.IGNORECASE) for r in allowed_patterns] +@pytest.mark.trace @pytest.mark.version('>=5.0') def test_1(act: Action, capsys): diff --git a/tests/bugs/gh_7558_test.py b/tests/bugs/gh_7558_test.py index 219e1376..ca790c37 100644 --- a/tests/bugs/gh_7558_test.py +++ b/tests/bugs/gh_7558_test.py @@ -35,6 +35,7 @@ substitutions = [('^((?!SQLSTATE|(I/O error)|(Error while)|335544344|335544734). act = python_act('db', substitutions = substitutions) act_non_existing_database = python_act('db_non_existing_database') +@pytest.mark.trace @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): diff --git a/tests/bugs/test_trace_eol.py b/tests/bugs/test_trace_eol.py new file mode 100644 index 00000000..5d83e4c1 --- /dev/null +++ b/tests/bugs/test_trace_eol.py @@ -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 diff --git a/tests/bugs/test_trace_eol_cr_space_nl.py b/tests/bugs/test_trace_eol_cr_space_nl.py new file mode 100644 index 00000000..5d83e4c1 --- /dev/null +++ b/tests/bugs/test_trace_eol_cr_space_nl.py @@ -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 diff --git a/tests/functional/services/test_role_in_service_attachment.py b/tests/functional/services/test_role_in_service_attachment.py index 11d72181..ab9dee3f 100644 --- a/tests/functional/services/test_role_in_service_attachment.py +++ b/tests/functional/services/test_role_in_service_attachment.py @@ -43,6 +43,7 @@ act = python_act('db') #expected_stdout = 'SUCCESS: found expected line format in the trace log: :' +@pytest.mark.trace @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): diff --git a/tests/functional/syspriv/test_trace_any_attachment.py b/tests/functional/syspriv/test_trace_any_attachment.py index 77a74b8e..bcb43483 100644 --- a/tests/functional/syspriv/test_trace_any_attachment.py +++ b/tests/functional/syspriv/test_trace_any_attachment.py @@ -29,6 +29,7 @@ tmp_usr2 = user_factory('db', name='tmp_stock_manager', password='123') act = python_act('db') +@pytest.mark.trace @pytest.mark.version('>=4.0') def test_1(act: Action, tmp_user: User, tmp_role: Role, tmp_usr2: User, capsys): diff --git a/tests/functional/transactions/test_read_consist_statement_delete_undone_01.py b/tests/functional/transactions/test_read_consist_statement_delete_undone_01.py index 72acd756..e657b745 100644 --- a/tests/functional/transactions/test_read_consist_statement_delete_undone_01.py +++ b/tests/functional/transactions/test_read_consist_statement_delete_undone_01.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_statement_delete_undone_02.py b/tests/functional/transactions/test_read_consist_statement_delete_undone_02.py index 2bd7ec7a..75dc97ce 100644 --- a/tests/functional/transactions/test_read_consist_statement_delete_undone_02.py +++ b/tests/functional/transactions/test_read_consist_statement_delete_undone_02.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_merge_deny_multiple_matches.py b/tests/functional/transactions/test_read_consist_sttm_merge_deny_multiple_matches.py index e439284e..2aa275ea 100644 --- a/tests/functional/transactions/test_read_consist_sttm_merge_deny_multiple_matches.py +++ b/tests/functional/transactions/test_read_consist_sttm_merge_deny_multiple_matches.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_max_limit.py b/tests/functional/transactions/test_read_consist_sttm_restart_max_limit.py index d441b563..9b4bad40 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_max_limit.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_max_limit.py @@ -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') def test_1(act: Action, fn_worker_sql: Path, fn_worker_log: Path, fn_worker_err: Path, capsys): diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_01.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_01.py index 68da7f96..91bdb750 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_01.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_01.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_02.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_02.py index 3cadea0d..12b21601 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_02.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_02.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_03.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_03.py index f3bef90e..8025706b 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_03.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_03.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_04.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_04.py index f6f1c217..45a4e504 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_04.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_delete_04.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_01.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_01.py index dbdb5cf2..9f021352 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_01.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_01.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_02.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_02.py index 5e737b29..e04d8c23 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_02.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_02.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_03.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_03.py index ea2dd34c..070c96b6 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_03.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_03.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_04.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_04.py index 5cf6736c..d6be7be4 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_04.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_merge_04.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_01.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_01.py index 52d6eab6..db931d0d 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_01.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_01.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_02.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_02.py index 1f4096c0..071519ba 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_02.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_02.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_03.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_03.py index 8763a9fb..418877a0 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_03.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_03.py @@ -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') 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() diff --git a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_04.py b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_04.py index ea6c94bf..1b9918a6 100644 --- a/tests/functional/transactions/test_read_consist_sttm_restart_on_update_04.py +++ b/tests/functional/transactions/test_read_consist_sttm_restart_on_update_04.py @@ -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') 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() diff --git a/tests/functional/trigger/database/test_disconnect_05.py b/tests/functional/trigger/database/test_disconnect_05.py index 2f44e11d..8a54dae4 100644 --- a/tests/functional/trigger/database/test_disconnect_05.py +++ b/tests/functional/trigger/database/test_disconnect_05.py @@ -71,6 +71,7 @@ substitutions = [ ('.* FAILED EXECUTE_TRIGGER_FINISH', 'FAILED EXECUTE_TRIGGER_F act = python_act('db', substitutions = substitutions) +@pytest.mark.trace @pytest.mark.version('>=5.0') def test_1(act: Action, tmp_worker: User, capsys): diff --git a/tests/functional/trigger/database/test_disconnect_06.py b/tests/functional/trigger/database/test_disconnect_06.py index 4b439761..b59368c0 100644 --- a/tests/functional/trigger/database/test_disconnect_06.py +++ b/tests/functional/trigger/database/test_disconnect_06.py @@ -44,6 +44,7 @@ substitutions = [ ('.* FAILED EXECUTE_TRIGGER_FINISH', 'FAILED EXECUTE_TRIGGER_F act = python_act('db', substitutions = substitutions) +@pytest.mark.trace @pytest.mark.version('>=5.0') def test_1(act: Action, tmp_worker: User, capsys):