2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-26 21:10:46 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-5985
|
|
|
|
ISSUE: 5985
|
|
|
|
TITLE: FB >= 3 crashes when restoring backup made by FB 2.5
|
|
|
|
DESCRIPTION:
|
|
|
|
This test also present in GTCS list, see it here:
|
|
|
|
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/SV_HIDDEN_VAR_2_5.script
|
|
|
|
JIRA: CORE-5719
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5719
|
2022-01-26 21:10:46 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-12-09 19:26:42 +01:00
|
|
|
import zipfile
|
|
|
|
from difflib import unified_diff
|
|
|
|
from pathlib import Path
|
2022-01-26 21:10:46 +01:00
|
|
|
from firebird.qa import *
|
2021-12-09 19:26:42 +01:00
|
|
|
from firebird.driver import SrvRestoreFlag
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-26 21:10:46 +01:00
|
|
|
fbk_file = temp_file('core5719-ods-11_2.fbk')
|
|
|
|
fdb_file = temp_file('check_restored_5719.fdb')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-09 19:26:42 +01:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-26 21:10:46 +01:00
|
|
|
def test_1(act: Action, fbk_file: Path, fdb_file: Path):
|
|
|
|
zipped_fbk_file = zipfile.Path(act.files_dir / 'core_5719-ods-11_2.zip',
|
2021-12-09 19:26:42 +01:00
|
|
|
at='core5719-ods-11_2.fbk')
|
2022-01-26 21:10:46 +01:00
|
|
|
fbk_file.write_bytes(zipped_fbk_file.read_bytes())
|
|
|
|
log_before = act.get_firebird_log()
|
2021-12-09 19:26:42 +01:00
|
|
|
#
|
2022-01-26 21:10:46 +01:00
|
|
|
with act.connect_server() as srv:
|
|
|
|
srv.database.restore(backup=fbk_file, database=fdb_file,
|
2021-12-09 19:26:42 +01:00
|
|
|
flags=SrvRestoreFlag.REPLACE, verbose=True)
|
|
|
|
restore_err = [line for line in srv if 'ERROR' in line.upper()]
|
2022-01-26 21:10:46 +01:00
|
|
|
log_after = act.get_firebird_log()
|
|
|
|
srv.database.validate(database=fdb_file)
|
2021-12-09 19:26:42 +01:00
|
|
|
validate_err = [line for line in srv if 'ERROR' in line.upper()]
|
|
|
|
#
|
|
|
|
assert restore_err == []
|
|
|
|
assert validate_err == []
|
|
|
|
assert list(unified_diff(log_before, log_after)) == []
|