6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-02-02 02:40:42 +01:00

Added/Updated tests\bugs\core_4524_test.py: Max waiting time for encryption/decryption to complete must be separated for different OS. MAX_WAIT_FOR_ENCR_FINISH_WIN and MAX_WAIT_FOR_ENCR_FINISH_NIX settings are used now from QA_GLOBALS['encryption'] instead of old MAX_ENCRYPT_DECRYPT_MS.

This commit is contained in:
pavel-zotov 2023-03-11 10:42:07 +03:00
parent 53a4107c3d
commit 5a1b144d4d

View File

@ -30,6 +30,7 @@ NOTES:
Checked on Linux and Windows: 3.0.8.33535 (SS/CS), 4.0.1.2692 (SS/CS)
"""
import os
import binascii
import re
import locale
@ -52,7 +53,11 @@ act_res = python_act('db_encrypt_restore')
# from act_src.files_dir/'test_config.ini':
enc_settings = QA_GLOBALS['encryption']
MAX_ENCRYPT_DECRYPT_MS = int(enc_settings['max_encrypt_decrypt_ms']) # 5000
# ACHTUNG: this must be carefully tuned on every new host:
#
MAX_WAITING_ENCR_FINISH = int(enc_settings['MAX_WAIT_FOR_ENCR_FINISH_WIN' if os.name == 'nt' else 'MAX_WAIT_FOR_ENCR_FINISH_NIX'])
assert MAX_WAITING_ENCR_FINISH > 0
ENCRYPTION_PLUGIN = enc_settings['encryption_plugin'] # fbSampleDbCrypt
ENCRYPTION_HOLDER = enc_settings['encryption_holder'] # fbSampleKeyHolder
ENCRYPTION_KEY = enc_settings['encryption_key'] # Red
@ -191,8 +196,8 @@ def test_1(act_src: Action, act_res: Action, tmp_fbk:Path, capsys):
while True:
t2=py_dt.datetime.now()
d1=t2-t1
if d1.seconds*1000 + d1.microseconds//1000 > MAX_ENCRYPT_DECRYPT_MS:
con.execute_immediate(f"select 'TIMEOUT EXPIRATION: encryption took {d1.seconds*1000 + d1.microseconds//1000} ms which exceeds limit = {MAX_ENCRYPT_DECRYPT_MS} ms.' as msg from rdb$database")
if d1.seconds*1000 + d1.microseconds//1000 > MAX_WAITING_ENCR_FINISH:
con.execute_immediate(f"select 'TIMEOUT EXPIRATION: encryption took {d1.seconds*1000 + d1.microseconds//1000} ms which exceeds limit = {MAX_WAITING_ENCR_FINISH} ms.' as msg from rdb$database")
break
# Possible output:
@ -206,7 +211,7 @@ def test_1(act_src: Action, act_res: Action, tmp_fbk:Path, capsys):
break
act_src.reset()
if d1.seconds*1000 + d1.microseconds//1000 <= MAX_ENCRYPT_DECRYPT_MS:
if d1.seconds*1000 + d1.microseconds//1000 <= MAX_WAITING_ENCR_FINISH:
act_src.reset()
act_src.gstat(switches=['-e'])
@ -234,7 +239,7 @@ def test_1(act_src: Action, act_res: Action, tmp_fbk:Path, capsys):
act_src.reset()
else:
print(f'TIMEOUT EXPIRATION: encryption took {d1.seconds*1000 + d1.microseconds//1000} ms which exceeds limit = {MAX_ENCRYPT_DECRYPT_MS} ms.')
print(f'TIMEOUT EXPIRATION: encryption took {d1.seconds*1000 + d1.microseconds//1000} ms which exceeds limit = {MAX_WAITING_ENCR_FINISH} ms.')
######################################################