6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/bugs/core_1885_test.py

135 lines
3.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_1885
# title: CREATE COLLATION connection lost under Posix
# decription: CREATE COLLATION connection lost under Posix when using LOCALE option
# tracker_id: CORE-1885
# min_versions: []
# versions: 3.0, 4.0
# qmid: bugs.core_1885-250
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 3.0
# resources: None
2021-10-21 19:29:23 +02:00
substitutions_1 = [('SPECIFIC_ATTR_BLOB_ID.*', ''),
2021-12-19 22:25:36 +01:00
('COLL-VERSION=\\d{2,}.\\d{2,}', 'COLL-VERSION=111.222')]
2021-04-26 20:07:00 +02:00
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
2021-10-21 19:29:23 +02:00
set list on;
set count on;
create collation unicode_enus_ci_4x for utf8 from unicode case insensitive 'LOCALE=en_US';
commit;
select
rc.rdb$collation_name
,rc.rdb$collation_attributes
,rc.rdb$base_collation_name
,rc.rdb$specific_attributes as specific_attr_blob_id
,rs.rdb$character_set_name
--,rs.rdb$number_of_characters
,rs.rdb$bytes_per_character
from rdb$collations rc
join rdb$character_sets rs
on rc.rdb$character_set_id = rs.rdb$character_set_id
where
rc.rdb$system_flag is distinct from 1
and rc.rdb$collation_name = upper('unicode_enus_ci_4x');
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
2021-10-21 19:29:23 +02:00
expected_stdout_1 = """
RDB$COLLATION_NAME UNICODE_ENUS_CI_4X
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1e7
2021-12-19 22:25:36 +01:00
COLL-VERSION=153.88;LOCALE=en_US
2021-10-21 19:29:23 +02:00
RDB$CHARACTER_SET_NAME UTF8
RDB$BYTES_PER_CHARACTER 4
Records affected: 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-16 10:03:34 +01:00
# [pcisar] 20.10.2021
# For 3.0.7 on Linux this PASS (uses system ICU) but on Windows (includes ICU 52)
# it FAIL unless newer ICU (63) is installed.
# 15.1.2022 As this issue was POSIX-only, we'll not run it on Windows.
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0,<4.0')
2022-01-16 10:03:34 +01:00
@pytest.mark.platform('Linux', 'Darwin')
2021-04-28 12:42:11 +02:00
def test_1(act_1: Action):
2021-10-21 19:29:23 +02:00
act_1.expected_stdout = expected_stdout_1
2021-04-26 20:07:00 +02:00
act_1.execute()
2021-12-22 20:23:11 +01:00
assert act_1.clean_stdout == act_1.clean_expected_stdout
2021-04-26 20:07:00 +02:00
# version: 4.0
# resources: None
2021-12-19 22:25:36 +01:00
substitutions_2 = [('SPECIFIC_ATTR_BLOB_ID.*', ''),
2022-01-16 10:03:34 +01:00
('COLL-VERSION=\\d{2,}.\\d{2,}', 'COLL-VERSION=111.222'),
('COLL-VERSION=\\d+\\.\\d+\\.\\d+\\.\\d+', 'COLL-VERSION=111.222')]
2021-04-26 20:07:00 +02:00
init_script_2 = """"""
db_2 = db_factory(sql_dialect=3, init=init_script_2)
test_script_2 = """
-- ::: NB ::: 31.01.2019
2021-10-21 19:29:23 +02:00
-- Since builds 4.0.0.1410, 26.01.2019, FULL ICU library icudt63l.dat is included in snapshot,
2021-04-26 20:07:00 +02:00
-- so this collation *CAN AND MUST* be created w/o errors.
set list on;
set count on;
create collation unicode_enus_ci_4x for utf8 from unicode case insensitive 'LOCALE=en_US';
commit;
select
rc.rdb$collation_name
,rc.rdb$collation_attributes
,rc.rdb$base_collation_name
,rc.rdb$specific_attributes as specific_attr_blob_id
,rs.rdb$character_set_name
--,rs.rdb$number_of_characters
,rs.rdb$bytes_per_character
from rdb$collations rc
join rdb$character_sets rs
on rc.rdb$character_set_id = rs.rdb$character_set_id
where
rc.rdb$system_flag is distinct from 1
and rc.rdb$collation_name = upper('unicode_enus_ci_4x');
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
act_2 = isql_act('db_2', test_script_2, substitutions=substitutions_2)
expected_stdout_2 = """
RDB$COLLATION_NAME UNICODE_ENUS_CI_4X
RDB$COLLATION_ATTRIBUTES 3
RDB$BASE_COLLATION_NAME UNICODE
SPECIFIC_ATTR_BLOB_ID 1d:1e7
2021-12-19 22:25:36 +01:00
COLL-VERSION=153.88;LOCALE=en_US
2021-04-26 20:07:00 +02:00
RDB$CHARACTER_SET_NAME UTF8
RDB$BYTES_PER_CHARACTER 4
Records affected: 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2021-04-28 12:42:11 +02:00
def test_2(act_2: Action):
2021-04-26 20:07:00 +02:00
act_2.expected_stdout = expected_stdout_2
act_2.execute()
2021-12-22 20:23:11 +01:00
assert act_2.clean_stdout == act_2.clean_expected_stdout
2021-04-26 20:07:00 +02:00