mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 21:43:06 +01:00
Added/Updated functional\syspriv\test_access_shutdown_database.py. Added substituion pair for suppressing '-Some database(s) were shutdown when trying to read mapping data' message that appears on Classic when we try to bring DB online using fbsvcmgr call. It seems to be a kind of bug. Sent report to Alex et al.
This commit is contained in:
parent
49c162c060
commit
c6f0563c44
@ -24,6 +24,7 @@ from firebird.driver import ShutdownMode,ShutdownMethod
|
|||||||
from firebird.driver.types import DatabaseError
|
from firebird.driver.types import DatabaseError
|
||||||
|
|
||||||
substitutions = [ ('no permission for (shutdown|(bring online)) access to database .*', 'no permission for shutdown/online access to database')
|
substitutions = [ ('no permission for (shutdown|(bring online)) access to database .*', 'no permission for shutdown/online access to database')
|
||||||
|
,('-Some database.* shutdown when trying to read mapping data', '') # <<< perhaps this is due to bug in Classic. May need to be deleted later // 25.09.2022
|
||||||
,('335544528 : database.* shutdown', '335544528 : database shutdown')
|
,('335544528 : database.* shutdown', '335544528 : database shutdown')
|
||||||
,('Data source : Firebird::localhost:.*', 'Data source : Firebird::localhost:')
|
,('Data source : Firebird::localhost:.*', 'Data source : Firebird::localhost:')
|
||||||
,('-At block line: [\\d]+, col: [\\d]+', '-At block line')
|
,('-At block line: [\\d]+, col: [\\d]+', '-At block line')
|
||||||
@ -126,6 +127,9 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
# Must FAIL: user has right only to *access* to DB in shutdown-single mode and make some DMLs there.
|
||||||
|
# But he has NO right to change DB state to shutdown (any kind of mode).
|
||||||
|
# Expected error: "no permission for shutdown/online access to database ..."
|
||||||
with act.connect_server(user = tmp_user.name, password = tmp_user.password, role = tmp_role.name) as srv_nondba:
|
with act.connect_server(user = tmp_user.name, password = tmp_user.password, role = tmp_role.name) as srv_nondba:
|
||||||
try:
|
try:
|
||||||
srv_nondba.database.shutdown(database=act.db.db_path
|
srv_nondba.database.shutdown(database=act.db.db_path
|
||||||
@ -136,7 +140,15 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
except DatabaseError as e:
|
except DatabaseError as e:
|
||||||
print(e.__str__())
|
print(e.__str__())
|
||||||
|
|
||||||
|
act.expected_stdout = expected_stdout_fbsvc
|
||||||
|
act.stdout = capsys.readouterr().out
|
||||||
|
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #0
|
||||||
|
act.reset()
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------
|
||||||
|
|
||||||
|
# Must PASS: we change DB state to shut-single using SYSDBA account.
|
||||||
|
# No message must be issued now:
|
||||||
with act.connect_server() as srv_sysdba:
|
with act.connect_server() as srv_sysdba:
|
||||||
try:
|
try:
|
||||||
srv_sysdba.database.shutdown(database=act.db.db_path
|
srv_sysdba.database.shutdown(database=act.db.db_path
|
||||||
@ -147,12 +159,14 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
except DatabaseError as e:
|
except DatabaseError as e:
|
||||||
print(e.__str__())
|
print(e.__str__())
|
||||||
|
|
||||||
act.expected_stdout = expected_stdout_fbsvc
|
act.expected_stdout = ''
|
||||||
act.stdout = capsys.readouterr().out
|
act.stdout = capsys.readouterr().out
|
||||||
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #1
|
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #1
|
||||||
act.reset()
|
act.reset()
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
# Result: DB now is in shutdown-single mode.
|
||||||
|
# We have to check that only single attachment can be established to this DB:
|
||||||
|
|
||||||
sql_chk='''
|
sql_chk='''
|
||||||
set list on;
|
set list on;
|
||||||
@ -181,6 +195,11 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# must FAIL: we attempt to bring DB online using NON-dba account:
|
# must FAIL: we attempt to bring DB online using NON-dba account:
|
||||||
|
# Expected error: "no permission for bring online access to database ..."
|
||||||
|
# !!!NB!!! As of 25.09.2022, for FB 4.x and 5.x in Classic mode additional message will raise here:
|
||||||
|
# "-Some database(s) were shutdown when trying to read mapping data"
|
||||||
|
# Sent report to Alex et al, 25.09.2022 18:55. Waiting for resolution.
|
||||||
|
#
|
||||||
with act.connect_server(user = tmp_user.name, password = tmp_user.password, role = tmp_role.name) as srv_nondba:
|
with act.connect_server(user = tmp_user.name, password = tmp_user.password, role = tmp_role.name) as srv_nondba:
|
||||||
try:
|
try:
|
||||||
srv_nondba.database.bring_online(database=act.db.db_path)
|
srv_nondba.database.bring_online(database=act.db.db_path)
|
||||||
@ -188,6 +207,11 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
except DatabaseError as e:
|
except DatabaseError as e:
|
||||||
print(e.__str__())
|
print(e.__str__())
|
||||||
|
|
||||||
|
act.expected_stdout = expected_stdout_fbsvc
|
||||||
|
act.stdout = capsys.readouterr().out
|
||||||
|
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #3
|
||||||
|
act.reset()
|
||||||
|
|
||||||
# must PASS because here we return DB online using SYSDBA account:
|
# must PASS because here we return DB online using SYSDBA account:
|
||||||
with act.connect_server() as srv_sysdba:
|
with act.connect_server() as srv_sysdba:
|
||||||
try:
|
try:
|
||||||
@ -196,7 +220,7 @@ def test_1(act: Action, tmp_user: User, tmp_role:Role, capsys):
|
|||||||
except DatabaseError as e:
|
except DatabaseError as e:
|
||||||
print(e.__str__())
|
print(e.__str__())
|
||||||
|
|
||||||
act.expected_stdout = expected_stdout_fbsvc
|
assert '' == capsys.readouterr().out
|
||||||
act.stdout = capsys.readouterr().out
|
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #4
|
||||||
assert act.clean_stdout == act.clean_expected_stdout # <<<<<<<<<<<<<<<<<<<<<<<< check #3
|
|
||||||
act.reset()
|
act.reset()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user