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

Added/Updated tests\functional\gtcs\test_ref_integ_drop_fk_index.py: Splitted expected* text because system triggers now are created in C++/GDML code

This commit is contained in:
pavel-zotov 2024-08-07 01:17:37 +03:00
parent 030a0e0946
commit 157052b60f

View File

@ -4,18 +4,24 @@
ID: gtcs.ref-integ-drop-fk-index
TITLE: Index that is used for FK should not be avail for DROP
DESCRIPTION:
Original test see in:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/REF_INT.4.ISQL.script
Original test see in:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/REF_INT.4.ISQL.script
This test uses pre-created script ( <QA_ROOT>/files/gtcs-ref-integ-init.sql ) which creates two
tables with PK/FK referencing constraint(parent = department, child = employee).
FK-constraint uses index with name = 'ref_key', and here we try to:
* DROP this index;
* insert record in the child table which has no apropriate PK in the parent table.
(see 'sql_addi' variable which stores SQL statements for that).
Both actions should fail.
This test uses pre-created script ( <QA_ROOT>/files/gtcs-ref-integ-init.sql ) which creates two
tables with PK/FK referencing constraint(parent = department, child = employee).
FK-constraint uses index with name = 'ref_key', and here we try to:
* DROP this index;
* insert record in the child table which has no apropriate PK in the parent table.
(see 'sql_addi' variable which stores SQL statements for that).
Both actions should fail.
FBTEST: functional.gtcs.ref_integ_drop_fk_index
FBTEST: functional.gtcs.ref_integ_drop_fk_index
NOTES:
[07.08.2024] pzotov
Splitted expected* text because system triggers now are created in C++/GDML code
See https://github.com/FirebirdSQL/firebird/pull/8202
Commit (05-aug-2024 13"45):
https://github.com/FirebirdSQL/firebird/commit/0cc8de396a3c2bbe13b161ecbfffa8055e7b4929
"""
import pytest
@ -30,7 +36,7 @@ test_expected_stdout = """
Records affected: 0
"""
test_expected_stderr = """
expected_stderr_5x = """
Statement failed, SQLSTATE = 27000
unsuccessful metadata update
-DROP INDEX REF_KEY failed
@ -43,6 +49,18 @@ test_expected_stderr = """
-Problematic key value is ("DEPT_NO" = -1)
"""
expected_stderr_6x = """
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-DROP INDEX REF_KEY failed
-Cannot delete index used by an Integrity Constraint
Statement failed, SQLSTATE = 23000
violation of FOREIGN KEY constraint "REF_KEY" on table "EMPLOYEE"
-Foreign key reference target does not exist
-Problematic key value is ("DEPT_NO" = -1)
"""
@pytest.mark.version('>=3.0')
def test_1(act: Action):
@ -54,9 +72,9 @@ def test_1(act: Action):
set count on;
select * from employee e where e.dept_no < 0;
'''
act.expected_stdout = test_expected_stdout
act.expected_stderr = test_expected_stderr
act.expected_stderr = expected_stderr_5x if act.is_version('<6') else expected_stderr_6x
act.isql(switches=['-q'], input = os.linesep.join( (sql_init, sql_addi) ) )