6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00

Added/Updated tests\bugs\core_5089_test.py: Writing code requires more care since 6.0.0.150: ISQL does not allow to specify THE SAME terminator twice

This commit is contained in:
pavel-zotov 2023-11-26 01:16:19 +03:00
parent 4326b911a4
commit 1804767499

View File

@ -3,17 +3,19 @@
""" """
ID: issue-5374 ID: issue-5374
ISSUE: 5374 ISSUE: 5374
TITLE: Metadata extration (ISQL -X): "CREATE PROCEDURE/FUNCTION" statement contains TITLE: Metadata extration (ISQL -X): "CREATE PROCEDURE/FUNCTION" statement contains reference to column of table(s) that not yet exists if this procedure had parameter of such type when it was created
reference to column of table(s) that not yet exists if this procedure had parameter
of such type when it was created
DESCRIPTION: DESCRIPTION:
Test creates database with table 'TEST' and standalone and packaged procedures and functions which have parameters or variables Test creates database with table 'TEST' and standalone and packaged procedures and functions which have parameters or variables
with referencing to the table 'TEST' column. Also, there are DB-level and DDL-level triggers with similar references. with referencing to the table 'TEST' column. Also, there are DB-level and DDL-level triggers with similar references.
Then we extract metadata and save it into file as 'initial' text. Then we extract metadata and save it into file as 'initial' text.
After this we drop all objects and make attempt to APPLY just extracted metadata script. It should perform without errors. After this we drop all objects and make attempt to APPLY just extracted metadata script. It should perform without errors.
Finally, we extract metadata again and do COMPARISON of their current content and those which are stored 'initial' file. Finally, we extract metadata again and do COMPARISON of their current content and those which are stored 'initial' file.
JIRA: CORE-5089 JIRA: CORE-5089
FBTEST: bugs.core_5089 FBTEST: bugs.core_5089
[25.11.2023] pzotov
Writing code requires more care since 6.0.0.150: ISQL does not allow to specify THE SAME terminator twice,
i.e.
set term @; select 1 from rdb$database @ set term @; - will not compile ("Unexpected end of command" raises).
""" """
import pytest import pytest
@ -150,7 +152,7 @@ init_script = """
end end
^ ^
set term ^; set term ;^
commit; commit;
""" """
@ -172,18 +174,23 @@ ddl_clear_all = """
@pytest.mark.version('>=3.0') @pytest.mark.version('>=3.0')
def test_1(act: Action): def test_1(act: Action):
# Extract metadata # Extract metadata
act.isql(switches=['-x']) act.isql(switches=['-x'], combine_output = True)
initial_metadata = act.stdout initial_metadata = act.stdout
# Clear all # Clear all
act.reset() act.reset()
act.isql(switches=[], input=ddl_clear_all)
act.isql(switches=[], input=ddl_clear_all, combine_output = True)
# Apply extracted metadata # Apply extracted metadata
act.reset() act.reset()
act.isql(switches=[], input=initial_metadata)
act.isql(switches=[], input=initial_metadata, combine_output = True)
# Extract new metadata # Extract new metadata
act.reset() act.reset()
act.isql(switches=['-x'])
act.isql(switches=['-x'], combine_output = True)
new_metadata = act.stdout new_metadata = act.stdout
# Check # Check
assert list(unified_diff(initial_metadata, new_metadata)) == [] assert list(unified_diff(initial_metadata, new_metadata)) == []