2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4642
|
|
|
|
ISSUE: 4642
|
|
|
|
TITLE: Engine crashes when trace config contains line "connection_id=NN" and we attempt to connect to non-existent database/alias
|
|
|
|
DESCRIPTION:
|
|
|
|
NOTES:
|
|
|
|
[15.1.2022] pcisar
|
|
|
|
This test fails on localized Windows due to encoding error and other
|
|
|
|
expected output differences, so we skip it for now.
|
|
|
|
JIRA: CORE-4319
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory()
|
2021-11-19 20:16:48 +01:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stderr = """
|
2021-11-19 20:16:48 +01:00
|
|
|
Rolling back work.
|
|
|
|
Statement failed, SQLSTATE = 08001
|
|
|
|
I/O error during "open" operation for file "some_non_existent"
|
|
|
|
-Error while trying to open file
|
|
|
|
-No such file or directory
|
|
|
|
Use CONNECT or CREATE DATABASE to specify a database
|
|
|
|
Command error: show database
|
|
|
|
Cannot get server version without database connection
|
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
trace = ['time_threshold = 0',
|
|
|
|
'log_errors = true',
|
|
|
|
'connection_id = 1234',
|
|
|
|
'log_connections = true',
|
|
|
|
]
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-11-19 20:16:48 +01:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
if act.platform == 'Windows':
|
2022-01-16 10:03:34 +01:00
|
|
|
pytest.skip("Windows: See note in test")
|
2022-01-23 20:41:55 +01:00
|
|
|
with act.trace(db_events=trace):
|
|
|
|
act.expected_stderr = expected_stderr
|
|
|
|
act.isql(switches=['-n'],
|
2021-11-19 20:16:48 +01:00
|
|
|
input="connect 'localhost:some_non_existent' user 'SYSDBA' password 'masterkey'; show database; show version;")
|
2021-12-07 20:09:36 +01:00
|
|
|
# check that we are still kicking (via trace exit) and got expected result from isql
|
2022-01-23 20:41:55 +01:00
|
|
|
assert act.clean_stderr == act.clean_expected_stderr
|