2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-19 17:54:56 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-632
|
|
|
|
ISSUE: 632
|
|
|
|
TITLE: Provide mechanism to get engine version without needing to call API function
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-1018
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_1018
|
2022-01-19 17:54:56 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2022-01-19 17:54:56 +01:00
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-19 17:54:56 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-09-28 13:01:44 +02:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set list on;
|
|
|
|
-- Engine version could contain more than one digit in any section or more sections.
|
|
|
|
-- Changed pattern for matching such cases of engine version as:
|
|
|
|
-- '3.2.23' or '3.3.2.1.0.1.2.3.4.5.7' etc
|
2023-09-28 13:01:44 +02:00
|
|
|
select iif( t.ev similar to '[1-9]+.[[:DIGIT:]]+.[[:DIGIT:]]+((.?[[:DIGIT:]]+)*)', 'PRESENTS', null) as version
|
2021-04-26 20:07:00 +02:00
|
|
|
from (
|
|
|
|
select rdb$get_context('SYSTEM', 'ENGINE_VERSION') ev
|
|
|
|
from rdb$database
|
|
|
|
)t;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-09-28 13:01:44 +02:00
|
|
|
act = isql_act('db', test_script, substitutions = [ ('[ \\t]+', ' ') ] )
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-09-28 13:01:44 +02:00
|
|
|
expected_stdout = """
|
|
|
|
VERSION PRESENTS
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-09-28 13:01:44 +02:00
|
|
|
@pytest.mark.version('>=3.0')
|
|
|
|
def test_3(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|