6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_5364_test.py

41 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5637
ISSUE: 5637
TITLE: gfix -online normal <db> (being issued in window #1) does not produce error
when there is sysdba attachment in window #2
2022-01-25 22:55:48 +01:00
DESCRIPTION:
We create new DB and immediately change its state to single-user maintanance.
Then we attach to this DB ans run (in separate process) 'gfix -online normal <localhost:this_db>'.
This command must produce in its STDERR error: "database ... shutdown" - and we check that this actually occurs.
Also, we check that after reconnect to this DB value of mon$database.mon$shutdown_mode remains the same: 2.
JIRA: CORE-5364
FBTEST: bugs.core_5364
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2022-01-25 22:55:48 +01:00
from firebird.qa import *
2021-12-06 19:23:35 +01:00
from firebird.driver import ShutdownMode, ShutdownMethod
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = python_act('db', substitutions=[('database .* shutdown', 'database shutdown')])
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
expected_stderr = """
2021-12-06 19:23:35 +01:00
database /test/test.fdb shutdown
"""
2021-04-26 20:07:00 +02:00
2021-12-06 19:23:35 +01:00
@pytest.mark.version('>=3.0.6')
2022-01-25 22:55:48 +01:00
def test_1(act: Action):
with act.connect_server() as srv:
srv.database.shutdown(database=act.db.db_path, mode=ShutdownMode.SINGLE,
2021-12-06 19:23:35 +01:00
method=ShutdownMethod.FORCED, timeout=0)
2022-01-25 22:55:48 +01:00
with act.db.connect() as con:
2021-12-06 19:23:35 +01:00
c = con.cursor()
sh_mode = c.execute('select mon$shutdown_mode from mon$database').fetchone()[0]
2022-01-25 22:55:48 +01:00
act.expected_stderr = expected_stderr
act.gfix(switches=['-online', 'normal', act.db.dsn])
2021-12-06 19:23:35 +01:00
assert sh_mode == 2
2022-01-25 22:55:48 +01:00
assert act.clean_stderr == act.clean_expected_stderr