6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated bugs\core_5921_test.py. Common temporary file must be used instead of temp database that is provided by db_factory(). See notes. Checked on Linux and Windows: 4.0.1.2692 (SS/CS).

This commit is contained in:
zotov 2022-09-22 09:12:39 +03:00
parent 1aebdaabb0
commit 0386c34cbb

View File

@ -3,8 +3,7 @@
"""
ID: issue-6179
ISSUE: 6179
TITLE: Provide information about Global Commit Number, Commit Number of currently used
database snapshot (if any) and Commit Numbers assigned to the committed transactions
TITLE: Provide information about Global Commit Number, Commit Number of currently used database snapshot (if any) and Commit Numbers assigned to the committed transactions
DESCRIPTION:
From doc\\sql.extensions\\README.builtin_functions.txt about rdb$get_transaction_cn() function:
===
@ -19,6 +18,8 @@ DESCRIPTION:
This ISQL-based test does NOT verify cases when tx is dead or in limbo.
Perhaps, Python-based implementation is required and will be created later.
JIRA: CORE-5921
FBTEST: bugs.core_5921
NOTES:
[05.03.2019]
renamed RDB$GET_CONTEXT('SYSTEM', 'SNAPSHOT_CN') to RDB$GET_CONTEXT('SYSTEM', 'SNAPSHOT_NUMBER')
@ -33,17 +34,34 @@ NOTES:
expected:
MSG_B For TX < OIT
GET_TX_B_CN 1
JIRA: CORE-5921
FBTEST: bugs.core_5921
[22.09.2022] pzotov
Difference with expected output was caused by auxiliary actions which are performed by qa-plugin
when test database is created and prepared for work.
It is necessary to make actions from this test with temporary database about which qa-plugin has no
any 'knowledge' that it is *database*. Common temporary file can serve for this purpuse.
After this temp file is declared, one may to use is as *database* by applying SQL script which has
'CREATE DATABASE <this_temp_file>' statement and furter actions.
Checked on Linux and Windows: 4.0.1.2692 (SS/CS).
"""
import locale
from pathlib import Path
import pytest
from firebird.qa import *
db = db_factory()
tmp_fdb = temp_file('tmp_5921.fdb')
test_script = """
db = db_factory()
act = isql_act('db', substitutions = [('[\t ]+', ' ')])
@pytest.mark.version('>=4.0')
def test_1(act: Action, tmp_fdb:Path, capsys):
init_sql = f"""
create database 'localhost:{tmp_fdb.absolute()}' user {act.db.user} password '{act.db.password}';
set list on;
-- select mon$database_name from mon$database;
set term ^;
create or alter procedure sp_set_tx_ctx( a_ctx_var_name varchar(80) ) as
begin
@ -105,34 +123,24 @@ test_script = """
^
set term ;^
commit;
drop database;
"""
act = isql_act('db', test_script, substitutions=[('GET_OIT_CN[ \t]+[\\d]+', 'GET_OIT_CN <digit>'),
('[ \t]+', ' ')])
expected_stdout = """
act.expected_stdout = """
MSG_A For TX > OIT
GET_TX_A_CN 0
MSG_B For TX < OIT
GET_TX_B_CN 1
GET_OIT_CN 9
GET_TX_C_CN 0
GET_TX_NUL_CN <null>
GET_TX_NXX_CN <null>
GET_TX_001_CN <null>
GET_TX_002_CN <null>
GET_TX_003_CN <null>
GLOBAL_CN_SIGN 1
SNAPSHOT_CN 1
"""
@pytest.mark.skip("FIXME: see notes")
@pytest.mark.version('>=4.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
act.isql(switches = ['-q'], input = init_sql, connect_db = False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout
act.reset()