2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-4275
|
|
|
|
ISSUE: 4275
|
|
|
|
TITLE: Restore from gbak backup using service doesn't report an error
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3942
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3942
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
|
2021-04-26 20:07:00 +02:00
|
|
|
import pytest
|
2021-11-18 20:15:37 +01:00
|
|
|
from pathlib import Path
|
2022-01-22 21:59:15 +01:00
|
|
|
from firebird.qa import *
|
2021-11-18 20:15:37 +01:00
|
|
|
from firebird.driver import DatabaseError
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
fbk_file = temp_file('test.fbk')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=2.5')
|
2022-01-22 21:59:15 +01:00
|
|
|
def test_1(act: Action, fbk_file: Path):
|
|
|
|
with act.connect_server() as srv:
|
|
|
|
srv.database.backup(database=act.db.db_path, backup=fbk_file)
|
2021-11-18 20:15:37 +01:00
|
|
|
srv.wait()
|
|
|
|
# Try overwrite existing database file
|
|
|
|
with pytest.raises(DatabaseError,
|
|
|
|
match='atabase .* already exists. To replace it, use the -REP switch'):
|
2022-01-22 21:59:15 +01:00
|
|
|
srv.database.restore(database=act.db.db_path, backup=fbk_file)
|
2021-11-18 20:15:37 +01:00
|
|
|
srv.wait()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
|