mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Fix for tests
This commit is contained in:
parent
c6ded23210
commit
c2246ae978
@ -2,26 +2,26 @@
|
||||
#
|
||||
# id: bugs.core_0304
|
||||
# title: ANY user can drop procedures, generators, exceptions.
|
||||
# decription:
|
||||
# decription:
|
||||
# fb30Cs, build 3.0.4.32924: OK, 4.406s.
|
||||
# FB30SS, build 3.0.4.32939: OK, 1.563s.
|
||||
#
|
||||
#
|
||||
# 24.01.2019. Added separate code for running on FB 4.0+.
|
||||
# UDF usage is deprecated in FB 4+, see: ".../doc/README.incompatibilities.3to4.txt".
|
||||
# Functions div, frac, dow, sdow, getExactTimestampUTC and isLeapYear got safe replacement
|
||||
# Functions div, frac, dow, sdow, getExactTimestampUTC and isLeapYear got safe replacement
|
||||
# in UDR library "udf_compat", see it in folder: ../plugins/udr/
|
||||
# Checked on:
|
||||
# 4.0.0.1172: OK, 8.140s.
|
||||
# 4.0.0.1340: OK, 4.797s.
|
||||
# 4.0.0.1378: OK, 4.032s.
|
||||
#
|
||||
#
|
||||
# 01.06.2021. Adjusted STDERR caused by fixes
|
||||
# https://github.com/FirebirdSQL/firebird/pull/6833
|
||||
# https://github.com/FirebirdSQL/firebird/pull/6825
|
||||
# ("Correct error message for DROP VIEW")
|
||||
# Checked on 3.0.8.33470; 4.0.0.2502; 5.0.0.60.
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# tracker_id: CORE-304
|
||||
# min_versions: ['3.0']
|
||||
# versions: 3.0, 4.0
|
||||
@ -71,7 +71,7 @@ test_script_1 = """
|
||||
-- All following statements should FAIL if current user is not SYSDBA:
|
||||
|
||||
execute procedure sp_test;
|
||||
|
||||
|
||||
show sequence g_test;
|
||||
|
||||
alter domain dm_test set default 123;
|
||||
@ -207,7 +207,7 @@ expected_stderr_1 = """
|
||||
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0,<4.0')
|
||||
@pytest.mark.version('>=3.0.8,<4.0')
|
||||
def test_1(act_1: Action, user_1: User):
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
act_1.execute()
|
||||
@ -262,7 +262,7 @@ test_script_2 = """
|
||||
-- All following statements should FAIL if current user is not SYSDBA:
|
||||
|
||||
execute procedure sp_test;
|
||||
|
||||
|
||||
show sequence g_test;
|
||||
|
||||
alter domain dm_test set default 123;
|
||||
|
@ -1032,10 +1032,10 @@ arithmetic exception, numeric overflow, or string truncation
|
||||
Statement failed, SQLSTATE = 07002
|
||||
Dynamic SQL Error
|
||||
-SQLDA error
|
||||
-No SQLDA for input values provided
|
||||
-Wrong number of parameters (expected 3, got 0)
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0,<4')
|
||||
@pytest.mark.version('>=3.0,<3.0.8')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.expected_stderr = expected_stderr_1
|
||||
@ -1078,7 +1078,7 @@ Dynamic SQL Error
|
||||
"""
|
||||
#-Wrong number of parameters (expected 3, got 0)
|
||||
|
||||
@pytest.mark.version('>=4.0')
|
||||
@pytest.mark.version('>=3.0.8')
|
||||
def test_2(act_2: Action):
|
||||
act_2.expected_stdout = expected_stdout_1
|
||||
act_2.expected_stderr = expected_stderr_2
|
||||
|
@ -29,7 +29,7 @@ init_script_1 = """
|
||||
commit;
|
||||
"""
|
||||
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1, charset='win1252')
|
||||
|
||||
test_script_1 = """
|
||||
set list on;
|
||||
@ -68,9 +68,6 @@ expected_stdout_1 = """
|
||||
F1 0123456789
|
||||
F2 abcdefghij
|
||||
CF 0123456789 - abcdefghij - more
|
||||
F1 0123456789
|
||||
F2 abcdefghij
|
||||
CF 0123456789 - abcdefghij - more
|
||||
FLD_NAME CF
|
||||
FLD_EXPR (f1 || ' - ' || f2 || ' - more')
|
||||
FLD_LENGTH 30
|
||||
|
@ -567,11 +567,10 @@ def test_1(act_1: Action):
|
||||
srv.database.local_restore(backup_stream=backup, database=act_1.db.db_path,
|
||||
flags=SrvRestoreFlag.DEACTIVATE_IDX | SrvRestoreFlag.REPLACE)
|
||||
# Get FB log before validation, run validation and get FB log after it:
|
||||
srv.info.get_log()
|
||||
log_before = srv.readlines()
|
||||
log_before = act_1.get_firebird_log()
|
||||
srv.database.repair(database=act_1.db.db_path, flags=SrvRepairFlag.CORRUPTION_CHECK)
|
||||
srv.info.get_log()
|
||||
log_after = srv.readlines()
|
||||
#act_1.gfix(switches=['-v', '-full', act_1.db.dsn])
|
||||
log_after = act_1.get_firebird_log()
|
||||
# Extract metadata from restored DB
|
||||
act_1.isql(switches=['-nod', '-x'])
|
||||
meta_2 = act_1.stdout
|
||||
|
@ -217,9 +217,10 @@ expected_stdout_1 = """
|
||||
"""
|
||||
|
||||
isql_script = temp_file('test-script.sql')
|
||||
isql_output = temp_file('test-script.out')
|
||||
|
||||
@pytest.mark.version('>=2.5.1')
|
||||
def test_1(act_1: Action, isql_script: Path, capsys):
|
||||
def test_1(act_1: Action, isql_script: Path, isql_output: Path, capsys):
|
||||
isql_script.write_text(''' set list on;
|
||||
set term ^;
|
||||
execute block returns (dts timestamp, sql varchar(80)) as
|
||||
@ -247,17 +248,17 @@ def test_1(act_1: Action, isql_script: Path, capsys):
|
||||
''')
|
||||
with act_1.connect_server() as srv:
|
||||
# Get content of firebird.log BEFORE test
|
||||
srv.info.get_log()
|
||||
log_before = srv.readlines()
|
||||
p_isql = subprocess.Popen([act_1.vars['isql'], act_1.db.dsn, '-i', str(isql_script)],
|
||||
stderr=subprocess.STDOUT)
|
||||
log_before = act_1.get_firebird_log()
|
||||
with open(isql_output, mode='w') as isql_out:
|
||||
p_isql = subprocess.Popen([act_1.vars['isql'], '-u', act_1.db.user, '-pas',
|
||||
act_1.db.password, act_1.db.dsn, '-i', str(isql_script)],
|
||||
stdout=isql_out, stderr=subprocess.STDOUT)
|
||||
time.sleep(2)
|
||||
# LAUNCH SWEEP while ISQL is working
|
||||
srv.database.sweep(database=act_1.db.db_path)
|
||||
p_isql.terminate()
|
||||
# Get content of firebird.log AFTER test
|
||||
srv.info.get_log()
|
||||
log_after = srv.readlines()
|
||||
log_after = act_1.get_firebird_log()
|
||||
for line in unified_diff(log_before, log_after):
|
||||
if line.startswith('+') and line.split('+'):
|
||||
print(line.replace('+', ' '))
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# id: bugs.core_2916
|
||||
# title: Broken error handling in the case of a conversion error happened during index creation
|
||||
# decription:
|
||||
# decription:
|
||||
# tracker_id: CORE-2916
|
||||
# min_versions: ['2.1.4']
|
||||
# versions: 2.5.0, 4.0
|
||||
@ -29,8 +29,7 @@ select * from tab where cast(col as int) is null;"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """Database: localhost:C:
|
||||
btest2 mpugs.core_2916.fdb, User: SYSDBA
|
||||
expected_stdout_1 = """Database: localhost:C:\\fbtest2\\tmp\\bugs.core_2916.fdb, User: SYSDBA
|
||||
SQL> SQL> SQL>
|
||||
COL
|
||||
===========
|
||||
|
@ -64,7 +64,7 @@ db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
|
||||
act_1 = python_act('db_1', substitutions=substitutions_1)
|
||||
|
||||
expected_stdout_1 = """
|
||||
Root page: 203, depth: 1, leaf buckets: 1, nodes: 2
|
||||
Root page: 203, depth: 1, leaf buckets: 1, nodes: 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=2.5.4,<4.0')
|
||||
@ -117,7 +117,7 @@ db_2 = db_factory(page_size=4096, sql_dialect=3, init=init_script_2)
|
||||
act_2 = python_act('db_2', substitutions=substitutions_2)
|
||||
|
||||
expected_stdout_2 = """
|
||||
Root page: 203, depth: 1, leaf buckets: 1, nodes: 2
|
||||
Root page: 203, depth: 1, leaf buckets: 1, nodes: 1
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=4.0')
|
||||
|
@ -25,7 +25,7 @@
|
||||
# qmid: None
|
||||
|
||||
import pytest
|
||||
from firebird.qa import db_factory, isql_act, Action
|
||||
from firebird.qa import db_factory, isql_act, Action, User, user_factory
|
||||
|
||||
# version: 3.0.1
|
||||
# resources: None
|
||||
@ -39,10 +39,6 @@ db_1 = db_factory(sql_dialect=3, init=init_script_1)
|
||||
test_script_1 = """
|
||||
set list on;
|
||||
|
||||
create or alter user tmp$c5225 password 'srp' using plugin Srp;
|
||||
create or alter user tmp$c5225 password 'leg' using plugin Legacy_UserManager;
|
||||
commit;
|
||||
|
||||
set term ^;
|
||||
execute block returns(whoami_leg varchar(31)) as
|
||||
begin
|
||||
@ -84,11 +80,6 @@ test_script_1 = """
|
||||
-- #############################################################################################
|
||||
delete from mon$attachments where mon$attachment_id != current_connection;
|
||||
commit;
|
||||
|
||||
drop user tmp$c5225 using plugin Srp;
|
||||
drop user tmp$c5225 using plugin Legacy_UserManager;
|
||||
commit;
|
||||
|
||||
"""
|
||||
|
||||
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
|
||||
@ -98,8 +89,11 @@ expected_stdout_1 = """
|
||||
WHOAMI_SRP TMP$C5225
|
||||
"""
|
||||
|
||||
user_srp = user_factory('db_1', name='tmp$c5225', password='srp', plugin='Srp')
|
||||
user_leg = user_factory('db_1', name='tmp$c5225', password='leg', plugin='Legacy_UserManager')
|
||||
|
||||
@pytest.mark.version('>=3.0.1')
|
||||
def test_1(act_1: Action):
|
||||
def test_1(act_1: Action, user_srp: User, user_leg: User):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
assert act_1.clean_stdout == act_1.clean_expected_stdout
|
||||
|
@ -2,17 +2,17 @@
|
||||
#
|
||||
# id: bugs.gh_6866
|
||||
# title: Some orphan records left at RDB$SECURITY_CLASSES and RDB$USER_PRIVILEGES after DROP PROCEDURE\\FUNCTION
|
||||
# decription:
|
||||
# decription:
|
||||
# https://github.com/FirebirdSQL/firebird/issues/6866
|
||||
#
|
||||
#
|
||||
# Note: code for 3.0.8 was separated from 4.x+: there is no 'sql security definer|invoker' clause before FB 4.x.
|
||||
# Only procedures, functions and packages are checked here.
|
||||
# More checks (for all other kinds of DB objects: tables, views etc) will be done in the test for GH-6868.
|
||||
#
|
||||
#
|
||||
# Confirmed bug on 5.0.0.82
|
||||
# Checked on 5.0.0.85; 4.0.1.2520; 3.0.8.33476.
|
||||
#
|
||||
# tracker_id:
|
||||
#
|
||||
# tracker_id:
|
||||
# min_versions: ['3.0.8']
|
||||
# versions: 3.0.8, 3.0.8
|
||||
# qmid: None
|
||||
@ -208,7 +208,7 @@ expected_stdout_1 = """
|
||||
MSG Number of rows in rdb$security_classes and rdb$user_privileges was not changed.
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0.8,<3.0.8')
|
||||
@pytest.mark.version('>=3.0.8,<4.0')
|
||||
def test_1(act_1: Action):
|
||||
act_1.expected_stdout = expected_stdout_1
|
||||
act_1.execute()
|
||||
@ -402,7 +402,7 @@ expected_stdout_2 = """
|
||||
MSG Number of rows in rdb$security_classes and rdb$user_privileges was not changed.
|
||||
"""
|
||||
|
||||
@pytest.mark.version('>=3.0.8')
|
||||
@pytest.mark.version('>=4.0')
|
||||
def test_2(act_2: Action):
|
||||
act_2.expected_stdout = expected_stdout_2
|
||||
act_2.execute()
|
||||
|
Loading…
Reference in New Issue
Block a user