2 @message |
assert ( and -11 == 0)
LOG DETAILS:
2025-05-28 04:20:28.137
2025-05-28 04:20:28.150 act = <firebird.qa.plugin.Action object at [hex]>
2025-05-28 04:20:28.161 tmp_file = PosixPath('/var/tmp/qa_2024/test_11300/0123456789012345678901234567890123456789012345678901234567890123456789012345678...890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234')
2025-05-28 04:20:28.179 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-05-28 04:20:28.193
2025-05-28 04:20:28.205 @pytest.mark.version('>=4.0')
2025-05-28 04:20:28.213 def test_1(act: Action, tmp_file:Path, capsys):
2025-05-28 04:20:28.224
2025-05-28 04:20:28.239 #################
2025-05-28 04:20:28.250 # ### ACHTUNG ###
2025-05-28 04:20:28.259 #################
2025-05-28 04:20:28.267 # DO NOT include ending double quote into the database name pattern!
2025-05-28 04:20:28.276 # String with database name is CUTED OFF when length of full path + filename is 243 and above:
2025-05-28 04:20:28.290 # 243 --> Database "C:\TEMP\...\01234567890<...>012345.F...
2025-05-28 04:20:28.304 # 244 --> Database "C:\TEMP\...\01234567890<...>0123456....
2025-05-28 04:20:28.316 # 245 --> Database "C:\TEMP\...\01234567890<...>01234567...
2025-05-28 04:20:28.326 # 246 ... 255 -- same as for 245. NB: for N=244 line differs from all others.
2025-05-28 04:20:28.335 # All these (cuted) strings have length = 254 bytes and do NOT contain ending double quote.
2025-05-28 04:20:28.344 # Because of this, we must include this character into the pattern only as OPTIONAL, i.e.: |'Database\s+"\S+(")?'|
2025-05-28 04:20:28.351 #
2025-05-28 04:20:28.360 interested_patterns = ( r'Database\s+"\S+(")?', r'[\t ]*Attributes([\t ]+\w+)?', r'[\t ]*Page buffers([\t ]+\d+)', r'[\t ]*Sweep interval(:)?([\t ]+\d+)', 'Database GUID')
2025-05-28 04:20:28.370 interested_patterns = [re.compile(p, re.IGNORECASE) for p in interested_patterns]
2025-05-28 04:20:28.379 protocol_list = ('', 'inet://', 'xnet://') if os.name == 'nt' else ('', 'inet://',)
2025-05-28 04:20:28.391
2025-05-28 04:20:28.404 full_str = str(tmp_file.absolute())
2025-05-28 04:20:28.414
2025-05-28 04:20:28.422 for chk_mode in ('fb_util', 'fbsvcmgr'):
2025-05-28 04:20:28.430 for protocol_prefix in protocol_list:
2025-05-28 04:20:28.439
2025-05-28 04:20:28.452 # NB: most strict limit for DB filename length origins from isql 'CONNECT' command:
2025-05-28 04:20:28.462 # 'command error' raises there if length of '{db_file_chk}' including qutes greater than 255.
2025-05-28 04:20:28.471 # Because of this, we can not operate with files with length of full name greater than 253 bytes.
2025-05-28 04:20:28.479 #
2025-05-28 04:20:28.487 db_file_len = 253 - len(protocol_prefix)
2025-05-28 04:20:28.494
2025-05-28 04:20:28.504 db_file_chk = Path((full_str[:db_file_len-4] + '.fdb').lower())
2025-05-28 04:20:28.516 db_file_dif = Path(os.path.splitext(db_file_chk)[0] + '.dif')
2025-05-28 04:20:28.524 db_file_fbk = Path(os.path.splitext(db_file_chk)[0] + '.fbk')
2025-05-28 04:20:28.530
2025-05-28 04:20:28.536 db_file_dif.unlink(missing_ok = True)
2025-05-28 04:20:28.542
2025-05-28 04:20:28.550 db_file_dsn = ''
2025-05-28 04:20:28.560 svc_call_starting_part = []
2025-05-28 04:20:28.571 if chk_mode == 'fb_util':
2025-05-28 04:20:28.579 db_file_dsn = protocol_prefix + str(db_file_chk)
2025-05-28 04:20:28.588 else:
2025-05-28 04:20:28.597 db_file_dsn = db_file_chk
2025-05-28 04:20:28.613 fb_svc_name = protocol_prefix + 'service_mgr'
2025-05-28 04:20:28.625 svc_call_starting_part = [ act.vars['fbsvcmgr'], fb_svc_name, '-user', act.db.user, '-password', act.db.password ]
2025-05-28 04:20:28.640
2025-05-28 04:20:28.651 sql_txt = f"""
2025-05-28 04:20:28.666 set list on;
2025-05-28 04:20:28.676 create database '{db_file_dsn}' user {act.db.user} password '{act.db.password}';
2025-05-28 04:20:28.682 select lower(mon$database_name) as mon_db_name from mon$database;
2025-05-28 04:20:28.688 select lower(rdb$get_context('SYSTEM', 'DB_NAME')) as ctx_db_name from mon$database;
2025-05-28 04:20:28.696 commit;
2025-05-28 04:20:28.709 """
2025-05-28 04:20:28.718
2025-05-28 04:20:28.726 act.expected_stdout = f"""
2025-05-28 04:20:28.735 MON_DB_NAME {db_file_chk}
2025-05-28 04:20:28.745 CTX_DB_NAME {db_file_chk}
2025-05-28 04:20:28.752 """
2025-05-28 04:20:28.758
2025-05-28 04:20:28.764 act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:28.770 assert act.clean_stdout == act.clean_expected_stdout
2025-05-28 04:20:28.775 act.reset()
2025-05-28 04:20:28.780
2025-05-28 04:20:28.785 svc_retcode = 0
2025-05-28 04:20:28.791 if chk_mode == 'fb_util':
2025-05-28 04:20:28.797 act.gfix(switches=['-buffers', '3791', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:28.803 else:
2025-05-28 04:20:28.811 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_page_buffers', '3791', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:28.818
2025-05-28 04:20:28.826 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:28.835 act.reset()
2025-05-28 04:20:28.846
2025-05-28 04:20:28.855
2025-05-28 04:20:28.867 if chk_mode == 'fb_util':
2025-05-28 04:20:28.878 act.gfix(switches=['-write','sync', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:28.889 else:
2025-05-28 04:20:28.902 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_write_mode', 'prp_wm_sync', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:28.915
2025-05-28 04:20:28.923 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:28.932 act.reset()
2025-05-28 04:20:28.944
2025-05-28 04:20:28.955
2025-05-28 04:20:28.964 if chk_mode == 'fb_util':
2025-05-28 04:20:28.982 act.gfix(switches=['-housekeeping','5678', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:28.995 else:
2025-05-28 04:20:29.004 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_sweep_interval', '5678', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.011
2025-05-28 04:20:29.019 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.028 act.reset()
2025-05-28 04:20:29.036
2025-05-28 04:20:29.043
2025-05-28 04:20:29.051 if chk_mode == 'fb_util':
2025-05-28 04:20:29.059 act.gfix(switches=['-use','full', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.065 else:
2025-05-28 04:20:29.074 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_reserve_space', 'prp_res_use_full', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.081
2025-05-28 04:20:29.088 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.096 act.reset()
2025-05-28 04:20:29.104
2025-05-28 04:20:29.110
2025-05-28 04:20:29.119 if chk_mode == 'fb_util':
2025-05-28 04:20:29.133 act.gfix(switches=['-sweep', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.143 else:
2025-05-28 04:20:29.153 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_repair', 'rpr_sweep_db', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.165
2025-05-28 04:20:29.174 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.186 act.reset()
2025-05-28 04:20:29.196
2025-05-28 04:20:29.207 if act.is_version('>=4'):
2025-05-28 04:20:29.221 if chk_mode == 'fb_util':
2025-05-28 04:20:29.232 act.gfix(switches=['-replica','read_write', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.240 else:
2025-05-28 04:20:29.258 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_replica_mode', 'prp_rm_readwrite', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.268
2025-05-28 04:20:29.277 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.285 act.reset()
2025-05-28 04:20:29.292
2025-05-28 04:20:29.302
2025-05-28 04:20:29.308 sql_txt = f"""
2025-05-28 04:20:29.315 -- Make connect using local protocol.
2025-05-28 04:20:29.322 -- NOTE: 'command error' raises here if length of '{db_file_chk}' including qutes greater than 255.
2025-05-28 04:20:29.331 connect '{db_file_chk}' user {act.db.user};
2025-05-28 04:20:29.347 alter database add difference file '{db_file_dif}';
2025-05-28 04:20:29.359 alter database begin backup;
2025-05-28 04:20:29.371 -- alter database set linger to 100;
2025-05-28 04:20:29.384 """
2025-05-28 04:20:29.395
2025-05-28 04:20:29.411 # Page buffers 3791
2025-05-28 04:20:29.420 # Attributes force write, no reserve, backup lock, read-write replica
2025-05-28 04:20:29.427 # Sweep interval: 5678
2025-05-28 04:20:29.434 #
2025-05-28 04:20:29.443 act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.451 assert act.clean_stdout == act.clean_expected_stdout
2025-05-28 04:20:29.457
2025-05-28 04:20:29.471 # WRONG for 4.x ... 5.x: assert '' == act.stdout -- noise characters are in output:
2025-05-28 04:20:29.485 # "Database: ..."
2025-05-28 04:20:29.501
2025-05-28 04:20:29.513 act.reset()
2025-05-28 04:20:29.530 _ = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
2025-05-28 04:20:29.541
2025-05-28 04:20:29.550 sql_txt = f"""
2025-05-28 04:20:29.563 -- Make connect using local protocol.
2025-05-28 04:20:29.572 -- NOTE: 'command error' raises here if length of '{db_file_chk}' including qutes greater than 255.
2025-05-28 04:20:29.581 connect '{db_file_chk}' user {act.db.user};
2025-05-28 04:20:29.591 -- alter database set linger to 0;
2025-05-28 04:20:29.598 alter database end backup;
2025-05-28 04:20:29.605 """
2025-05-28 04:20:29.613 act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.621 assert act.clean_stdout == act.clean_expected_stdout
2025-05-28 04:20:29.628 act.reset()
2025-05-28 04:20:29.634
2025-05-28 04:20:29.641 if chk_mode == 'fb_util':
2025-05-28 04:20:29.655 act.gfix(switches=['-mode','read_only', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.667 else:
2025-05-28 04:20:29.677 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_access_mode', 'prp_am_readonly', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.685
2025-05-28 04:20:29.692 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.700 act.reset()
2025-05-28 04:20:29.707 _ = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
2025-05-28 04:20:29.715
2025-05-28 04:20:29.723
2025-05-28 04:20:29.731 if chk_mode == 'fb_util':
2025-05-28 04:20:29.739 act.gfix(switches=['-shut','single', '-at', '20', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.746 else:
2025-05-28 04:20:29.762 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_shutdown_mode', 'prp_sm_single', 'prp_deny_new_attachments', '20', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.777
2025-05-28 04:20:29.790 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.800 act.reset()
2025-05-28 04:20:29.808
2025-05-28 04:20:29.817 src_guid = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
2025-05-28 04:20:29.829
2025-05-28 04:20:29.841
2025-05-28 04:20:29.850 if chk_mode == 'fb_util':
2025-05-28 04:20:29.860 act.gfix(switches=['-online', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.869 else:
2025-05-28 04:20:29.877 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_online_mode', 'prp_sm_normal', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.884
2025-05-28 04:20:29.891 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:29.898 act.reset()
2025-05-28 04:20:29.914
2025-05-28 04:20:29.926
2025-05-28 04:20:29.937 if chk_mode == 'fb_util':
2025-05-28 04:20:29.948 act.gfix(switches=['-v', '-full', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:29.958 else:
2025-05-28 04:20:29.967 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_repair', 'rpr_validate_db', 'rpr_full', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:29.977
2025-05-28 04:20:29.992 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:30.005 act.reset()
2025-05-28 04:20:30.015
2025-05-28 04:20:30.022
2025-05-28 04:20:30.031 if chk_mode == 'fb_util':
2025-05-28 04:20:30.039 act.gbak(switches=['-b', db_file_dsn, db_file_fbk], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:30.046 else:
2025-05-28 04:20:30.056 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_backup', 'dbname', db_file_chk, 'bkp_file', db_file_fbk], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:30.065
2025-05-28 04:20:30.078 assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:30.088 act.reset()
2025-05-28 04:20:30.095
2025-05-28 04:20:30.102
2025-05-28 04:20:30.109 if chk_mode == 'fb_util':
2025-05-28 04:20:30.118 act.gbak(switches=['-rep', db_file_fbk, db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
2025-05-28 04:20:30.132 else:
2025-05-28 04:20:30.146 svc_retcode = (subprocess.run( svc_call_starting_part + ['action_restore', 'dbname', db_file_chk, 'bkp_file', db_file_fbk, 'res_replace' ], stderr = subprocess.STDOUT)).returncode
2025-05-28 04:20:30.159
2025-05-28 04:20:30.173 > assert '' == act.stdout and svc_retcode == 0
2025-05-28 04:20:30.185 E assert ( and -11 == 0)
2025-05-28 04:20:30.194
2025-05-28 04:20:30.206 tests/bugs/core_6248_test.py:368: AssertionError
2025-05-28 04:20:30.213 ---------------------------- Captured stdout setup -----------------------------
2025-05-28 04:20:30.221 Creating db: localhost:/var/tmp/qa_2024/test_11300/test.fdb [page_size=None, sql_dialect=None, charset='NONE', user=SYSDBA, password=masterkey]
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
tmp_file = PosixPath('/var/tmp/qa_2024/test_11300/0123456789012345678901234567890123456789012345678901234567890123456789012345678...890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234')
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=4.0')
def test_1(act: Action, tmp_file:Path, capsys):
#################
# ### ACHTUNG ###
#################
# DO NOT include ending double quote into the database name pattern!
# String with database name is CUTED OFF when length of full path + filename is 243 and above:
# 243 --> Database "C:\TEMP\...\01234567890<...>012345.F...
# 244 --> Database "C:\TEMP\...\01234567890<...>0123456....
# 245 --> Database "C:\TEMP\...\01234567890<...>01234567...
# 246 ... 255 -- same as for 245. NB: for N=244 line differs from all others.
# All these (cuted) strings have length = 254 bytes and do NOT contain ending double quote.
# Because of this, we must include this character into the pattern only as OPTIONAL, i.e.: |'Database\s+"\S+(")?'|
#
interested_patterns = ( r'Database\s+"\S+(")?', r'[\t ]*Attributes([\t ]+\w+)?', r'[\t ]*Page buffers([\t ]+\d+)', r'[\t ]*Sweep interval(:)?([\t ]+\d+)', 'Database GUID')
interested_patterns = [re.compile(p, re.IGNORECASE) for p in interested_patterns]
protocol_list = ('', 'inet://', 'xnet://') if os.name == 'nt' else ('', 'inet://',)
full_str = str(tmp_file.absolute())
for chk_mode in ('fb_util', 'fbsvcmgr'):
for protocol_prefix in protocol_list:
# NB: most strict limit for DB filename length origins from isql 'CONNECT' command:
# 'command error' raises there if length of '{db_file_chk}' including qutes greater than 255.
# Because of this, we can not operate with files with length of full name greater than 253 bytes.
#
db_file_len = 253 - len(protocol_prefix)
db_file_chk = Path((full_str[:db_file_len-4] + '.fdb').lower())
db_file_dif = Path(os.path.splitext(db_file_chk)[0] + '.dif')
db_file_fbk = Path(os.path.splitext(db_file_chk)[0] + '.fbk')
db_file_dif.unlink(missing_ok = True)
db_file_dsn = ''
svc_call_starting_part = []
if chk_mode == 'fb_util':
db_file_dsn = protocol_prefix + str(db_file_chk)
else:
db_file_dsn = db_file_chk
fb_svc_name = protocol_prefix + 'service_mgr'
svc_call_starting_part = [ act.vars['fbsvcmgr'], fb_svc_name, '-user', act.db.user, '-password', act.db.password ]
sql_txt = f"""
set list on;
create database '{db_file_dsn}' user {act.db.user} password '{act.db.password}';
select lower(mon$database_name) as mon_db_name from mon$database;
select lower(rdb$get_context('SYSTEM', 'DB_NAME')) as ctx_db_name from mon$database;
commit;
"""
act.expected_stdout = f"""
MON_DB_NAME {db_file_chk}
CTX_DB_NAME {db_file_chk}
"""
act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
svc_retcode = 0
if chk_mode == 'fb_util':
act.gfix(switches=['-buffers', '3791', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_page_buffers', '3791', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-write','sync', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_write_mode', 'prp_wm_sync', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-housekeeping','5678', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_sweep_interval', '5678', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-use','full', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_reserve_space', 'prp_res_use_full', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-sweep', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_repair', 'rpr_sweep_db', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if act.is_version('>=4'):
if chk_mode == 'fb_util':
act.gfix(switches=['-replica','read_write', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_replica_mode', 'prp_rm_readwrite', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
sql_txt = f"""
-- Make connect using local protocol.
-- NOTE: 'command error' raises here if length of '{db_file_chk}' including qutes greater than 255.
connect '{db_file_chk}' user {act.db.user};
alter database add difference file '{db_file_dif}';
alter database begin backup;
-- alter database set linger to 100;
"""
# Page buffers 3791
# Attributes force write, no reserve, backup lock, read-write replica
# Sweep interval: 5678
#
act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout
# WRONG for 4.x ... 5.x: assert '' == act.stdout -- noise characters are in output:
# "SQL> SQL> SQL> SQL> Database: ..."
act.reset()
_ = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
sql_txt = f"""
-- Make connect using local protocol.
-- NOTE: 'command error' raises here if length of '{db_file_chk}' including qutes greater than 255.
connect '{db_file_chk}' user {act.db.user};
-- alter database set linger to 0;
alter database end backup;
"""
act.isql(switches = ['-q'], input = sql_txt, connect_db=False, credentials = False, combine_output = True, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-mode','read_only', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_access_mode', 'prp_am_readonly', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
_ = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
if chk_mode == 'fb_util':
act.gfix(switches=['-shut','single', '-at', '20', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_shutdown_mode', 'prp_sm_single', 'prp_deny_new_attachments', '20', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
src_guid = check_db_hdr_info(act, db_file_chk, interested_patterns, capsys)
if chk_mode == 'fb_util':
act.gfix(switches=['-online', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_properties', 'prp_online_mode', 'prp_sm_normal', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gfix(switches=['-v', '-full', db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_repair', 'rpr_validate_db', 'rpr_full', 'dbname', db_file_chk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gbak(switches=['-b', db_file_dsn, db_file_fbk], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_backup', 'dbname', db_file_chk, 'bkp_file', db_file_fbk], stderr = subprocess.STDOUT)).returncode
assert '' == act.stdout and svc_retcode == 0
act.reset()
if chk_mode == 'fb_util':
act.gbak(switches=['-rep', db_file_fbk, db_file_dsn], combine_output = True, io_enc = locale.getpreferredencoding())
else:
svc_retcode = (subprocess.run( svc_call_starting_part + ['action_restore', 'dbname', db_file_chk, 'bkp_file', db_file_fbk, 'res_replace' ], stderr = subprocess.STDOUT)).returncode
> assert '' == act.stdout and svc_retcode == 0
E assert ( and -11 == 0)
tests/bugs/core_6248_test.py:368: AssertionError
|