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

Added/Updated tests\functional\basic\isql\test_08.py: Added 'SQLSTATE' and 'error' to the list of tokens in substitutions which must NOT be filtered out. See other notes.

This commit is contained in:
pavel-zotov 2023-12-08 16:36:25 +03:00
parent b249325543
commit c7a89c646e

View File

@ -6,10 +6,15 @@ ISSUE: https://github.com/FirebirdSQL/firebird/issues/7001
TITLE: ISQL showing publication status
DESCRIPTION:
NOTES:
[20.04.2023] pzotov
command 'show pub;' currently displays "There is no publications in this database".
This is expected. Detailed output of this command will be implemented later (discussed with dimitr).
Checked on 5.0.0.1022 (intermediate build)
[08.12.2023] pzotov
Added 'SQLSTATE' and 'error' to the list of tokens in substitutions which must NOT be filtered out.
We have to take in account them is they occur, otherwise one can not to understand what goes wrong
in case if test database that serves as master is absent (content of STDERR can not be saved in XML).
Now, if db_main_alias points to non-existing file, we have to see:
Statement failed, SQLSTATE = 08001
I/O error during "CreateFile (open)" operation for file "db_main_alias"
Command error: show database
Thanks to Adriano for note with initial problem descriprion.
"""
import locale
import pytest
@ -17,23 +22,25 @@ from firebird.qa import *
# QA_GLOBALS -- dict, is defined in qa/plugin.py, obtain settings
# from act.files_dir/'test_config.ini':
#
repl_settings = QA_GLOBALS['replication']
MAIN_DB_ALIAS = repl_settings['main_db_alias']
db_main = db_factory( filename = '#' + MAIN_DB_ALIAS, do_not_create = True, do_not_drop = True)
substitutions = [('^((?!(Publication:|RDB\\$DEFAULT)).)*$', ''),]
substitutions = [('^((?!(SQLSTATE|error|Publication:|RDB\\$DEFAULT)).)*$', ''),]
act_db_main = python_act('db_main', substitutions = substitutions)
#--------------------------------------------
@pytest.mark.version('>=5.0')
def test_1(act_db_main: Action, capsys):
def test_1(act_db_main: Action):
test_sql = """
show database;
show sys pub;
set bail on;
set list on;
show database; -- must include: "Publication: enabled"
show sys pub; -- must be: RDB$DEFAULT
show pub rdb$default;
"""
@ -42,5 +49,5 @@ def test_1(act_db_main: Action, capsys):
RDB$DEFAULT
RDB$DEFAULT: Enabled, Auto-enable
"""
act_db_main.isql(switches=['-q', '-nod'], input = test_sql, combine_output = True, io_enc = locale.getpreferredencoding())
act_db_main.isql(switches=['-q', '-nod'], input = test_sql, combine_output = True,io_enc = locale.getpreferredencoding())
assert act_db_main.clean_stdout == act_db_main.clean_expected_stdout