2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3322
|
|
|
|
ISSUE: 3322
|
|
|
|
TITLE: Trace output could contain garbage data left from filtered out statements
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-2940
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_2940
|
2022-01-21 18:49:26 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
db = db_factory()
|
2021-11-16 19:44:53 +01:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
act = python_act('db', substitutions=[('^((?!records fetched).)*$', '')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
1 records fetched
|
2021-11-16 19:44:53 +01:00
|
|
|
"""
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
test_script = """
|
2021-11-16 19:44:53 +01:00
|
|
|
set list on;
|
|
|
|
-- statistics for this statement SHOULD appear in trace log:
|
|
|
|
select 1 k1 from rdb$database;
|
|
|
|
commit;
|
|
|
|
-- statistics for this statement should NOT appear in trace log:
|
|
|
|
select 2 k2 from rdb$types rows 2 /* no_trace*/;
|
|
|
|
-- statistics for this statement should NOT appear in trace log:
|
|
|
|
select 3 no_trace from rdb$types rows 3;
|
|
|
|
-- statistics for this statement should NOT appear in trace log:
|
|
|
|
set term ^;
|
|
|
|
execute block returns(k4 int) as
|
|
|
|
begin
|
|
|
|
for select 4 from rdb$types rows 4 into k4 do suspend;
|
|
|
|
end -- no_trace
|
|
|
|
^
|
|
|
|
set term ;^
|
|
|
|
"""
|
|
|
|
|
2022-01-21 18:49:26 +01:00
|
|
|
trace = ['log_connections = true',
|
2021-12-07 20:09:36 +01:00
|
|
|
'log_transactions = true',
|
|
|
|
'log_statement_finish = true',
|
|
|
|
'print_plan = true',
|
|
|
|
'print_perf = true',
|
2021-12-14 20:56:34 +01:00
|
|
|
'time_threshold = 0',
|
|
|
|
'exclude_filter = %no_trace%',
|
2021-12-07 20:09:36 +01:00
|
|
|
]
|
2021-11-16 19:44:53 +01:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-21 18:49:26 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
with act.trace(db_events=trace):
|
|
|
|
act.isql(switches=['-n'], input=test_script)
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.trace_to_stdout()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|