2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-25 22:55:48 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-5573
|
|
|
|
ISSUE: 5573
|
|
|
|
TITLE: Validation could read after the end-of-file when handle multifile database
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5295
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5295
|
2023-12-13 10:53:06 +01:00
|
|
|
NOTES:
|
|
|
|
[13.12.2023] pzotov
|
|
|
|
Adjusted substitutions: runtime error must not be filtered out by '?!(...)' pattern
|
|
|
|
("negative lookahead assertion", see https://docs.python.org/3/library/re.html#regular-expression-syntax).
|
|
|
|
Added 'combine_output = True' in order to see error messages produced by 'gfix -v'
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-12-06 19:23:35 +01:00
|
|
|
from pathlib import Path
|
2022-01-25 22:55:48 +01:00
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
db = db_factory(from_backup='core5295.fbk')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2023-12-13 10:53:06 +01:00
|
|
|
act = python_act('db', substitutions=[('[ \t]+', ' '), ('^((?!checked_size|[Ee]rror|[Rr]eached).)*$', '')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-06 19:23:35 +01:00
|
|
|
fbk_file = temp_file('tmp_core_5295.fbk')
|
|
|
|
fdb_file_1 = temp_file('tmp_core_5295-1.fdb')
|
|
|
|
fdb_file_2 = temp_file('tmp_core_5295-2.db1')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-12-06 19:23:35 +01:00
|
|
|
@pytest.mark.version('>=2.5.6')
|
2022-01-25 22:55:48 +01:00
|
|
|
def test_1(act: Action, fbk_file: Path, fdb_file_1: Path, fdb_file_2: Path):
|
|
|
|
with act.connect_server() as srv:
|
|
|
|
srv.database.backup(database=act.db.db_path, backup=fbk_file)
|
2021-12-06 19:23:35 +01:00
|
|
|
srv.wait()
|
2021-12-07 13:36:20 +01:00
|
|
|
srv.database.restore(backup=fbk_file,
|
|
|
|
database=[fdb_file_1, fdb_file_2],
|
2021-12-06 19:23:35 +01:00
|
|
|
db_file_pages=[100000])
|
|
|
|
srv.wait()
|
2023-12-13 10:53:06 +01:00
|
|
|
|
2021-12-06 19:23:35 +01:00
|
|
|
# Only 'gfix -v' raised error. Online validation works fine:
|
2023-12-13 10:53:06 +01:00
|
|
|
act.gfix(switches=['-v', act.get_dsn(fdb_file_1)], combine_output = True)
|
2022-01-25 22:55:48 +01:00
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|