2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-23 20:41:55 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-4720
|
|
|
|
ISSUE: 4720
|
2022-02-02 15:46:19 +01:00
|
|
|
TITLE: Provide ability to specify extra-long name of log when doing gbak to avoid
|
|
|
|
"attempt to store 256 bytes in a clumplet" message
|
2022-01-23 20:41:55 +01:00
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-4398
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_4398
|
2022-01-23 20:41:55 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-11-26 19:20:43 +01:00
|
|
|
from pathlib import Path
|
2022-01-23 20:41:55 +01:00
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
db = db_factory()
|
2021-11-26 19:20:43 +01:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
act = python_act('db')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
Starting backup...
|
|
|
|
Backup finished.
|
|
|
|
Delete backup file...
|
|
|
|
Backup file deleted.
|
|
|
|
Delete log file...
|
|
|
|
Log file deleted.
|
2021-11-26 19:20:43 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-23 20:41:55 +01:00
|
|
|
backup_file = temp_file('backup.fbk')
|
|
|
|
log_file = temp_file('A012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.log')
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2021-11-26 19:20:43 +01:00
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-23 20:41:55 +01:00
|
|
|
def test_1(act: Action, capsys, log_file: Path, backup_file: Path):
|
2021-11-26 19:20:43 +01:00
|
|
|
print ('Starting backup...')
|
2022-01-23 20:41:55 +01:00
|
|
|
act.gbak(switches=['-b', '-v', '-y', str(log_file), str(act.db.db_path), str(backup_file)])
|
2021-11-26 19:20:43 +01:00
|
|
|
print ('Backup finished.')
|
2022-01-23 20:41:55 +01:00
|
|
|
if backup_file.is_file():
|
2021-11-26 19:20:43 +01:00
|
|
|
print ('Delete backup file...')
|
2022-01-23 20:41:55 +01:00
|
|
|
backup_file.unlink()
|
2021-11-26 19:20:43 +01:00
|
|
|
print ('Backup file deleted.')
|
|
|
|
print ('Delete log file...')
|
2022-01-23 20:41:55 +01:00
|
|
|
log_file.unlink()
|
2021-11-26 19:20:43 +01:00
|
|
|
print ('Log file deleted.')
|
2022-01-23 20:41:55 +01:00
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.stdout = capsys.readouterr().out
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|