6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_4889_test.py

68 lines
2.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5183
ISSUE: 5183
TITLE: FBSVCMGR with `action_trace_start` prevents in 3.0 SuperServer from connecting using local protocol
DESCRIPTION:
JIRA: CORE-4889
FBTEST: bugs.core_4889
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = python_act('db')
2021-11-26 19:20:43 +01:00
2022-01-24 20:27:02 +01:00
isq_script = """
set list on;
set count on;
select
iif(a.mon$remote_protocol is null, 'internal', 'remote') as connection_protocol,
iif(a.mon$remote_process is null, 'internal', 'remote') as connection_process,
iif(a.mon$remote_pid is null, 'internal', 'remote') as connection_remote_pid,
a.mon$auth_method as auth_method -- should be: 'User name in DPB'
from rdb$database r
left join mon$attachments a on a.mon$attachment_id = current_connection and a.mon$system_flag = 0;
commit;
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
OK: found text in trace related to EMBEDDED connect.
CONNECTION_PROTOCOL internal
CONNECTION_PROCESS internal
CONNECTION_REMOTE_PID internal
AUTH_METHOD User name in DPB
Records affected: 1
2021-11-26 19:20:43 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
trace = ['time_threshold = 0',
'log_initfini = false',
'log_errors = true',
'log_statement_finish = true',
]
2021-04-26 20:07:00 +02:00
2021-11-26 19:20:43 +01:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
def test_1(act: Action, capsys):
with act.trace(db_events=trace):
act.isql(switches=['-n', '-user', 'tmp$no$such$user$4889', str(act.db.db_path)],
connect_db=False, credentials=False, input=isq_script)
# Process trace log
2021-11-26 19:20:43 +01:00
i = 0
2022-01-24 20:27:02 +01:00
for line in act.trace_log:
2021-11-26 19:20:43 +01:00
if ') EXECUTE_STATEMENT_FINISH' in line:
i = 1
if i == 1 and '1 records fetched' in line:
i = 2
print("OK: found text in trace related to EMBEDDED connect.")
break
if not i == 2:
print("FAILED to find text in trace related to EMBEDDED connect.")
2022-01-24 20:27:02 +01:00
print(act.stdout if act.stdout else "FAILED to print log from EMBEDDED connect: log is EMPTY.")
2021-11-26 19:20:43 +01:00
# Check
2022-01-24 20:27:02 +01:00
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout