2 @message |
assert
FAILED EXECUTE_TRIGGER_FINISH
- ERROR AT purge_attachment
335544382 : paramètre non trouvé
335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
335544842 : At trigger 'gâchette de déconnexion'
LOG DETAILS:
2025-02-25 17:08:15.415
2025-02-25 17:08:15.426 act = <firebird.qa.plugin.Action object at [hex]>
2025-02-25 17:08:15.441 tmp_worker = <firebird.qa.plugin.User object at [hex]>
2025-02-25 17:08:15.453 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-02-25 17:08:15.465
2025-02-25 17:08:15.479 @pytest.mark.intl
2025-02-25 17:08:15.490 @pytest.mark.trace
2025-02-25 17:08:15.497 @pytest.mark.version('>=4.0')
2025-02-25 17:08:15.504 def test_1(act: Action, tmp_worker: User, capsys):
2025-02-25 17:08:15.515
2025-02-25 17:08:15.524 init_sql = f"""
2025-02-25 17:08:15.530 set list on;
2025-02-25 17:08:15.536 set bail on;
2025-02-25 17:08:15.543 create exception "paramètre non trouvé" q'#Paramètre "@1" a une valeur incorrecte ou n'a pas été trouvé dans#';
2025-02-25 17:08:15.559 set term ^;
2025-02-25 17:08:15.574 ^
2025-02-25 17:08:15.588 create trigger "gâchette de déconnexion" on disconnect as
2025-02-25 17:08:15.598 begin
2025-02-25 17:08:15.605 if ( current_user != '{act.db.user}' ) then
2025-02-25 17:08:15.611 begin
2025-02-25 17:08:15.618 exception "paramètre non trouvé" using ('fréquence fermée');
2025-02-25 17:08:15.627 end
2025-02-25 17:08:15.635 end
2025-02-25 17:08:15.643 ^
2025-02-25 17:08:15.658 set term ;^
2025-02-25 17:08:15.672 commit;
2025-02-25 17:08:15.684 """
2025-02-25 17:08:15.694
2025-02-25 17:08:15.703 #tmp_sql.write_bytes( bytes(init_sql.encode('utf-8')) )
2025-02-25 17:08:15.711 #act.isql(switches=['-q'], input_file = tmp_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2025-02-25 17:08:15.719
2025-02-25 17:08:15.724 act.expected_stdout = ''
2025-02-25 17:08:15.729 act.isql(switches=['-q'], input = init_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2025-02-25 17:08:15.735 assert act.clean_stdout == act.clean_expected_stdout
2025-02-25 17:08:15.740 act.reset()
2025-02-25 17:08:15.747
2025-02-25 17:08:15.753 # ----------------------------------------------------------------------------------------------
2025-02-25 17:08:15.759 with act.connect_server(encoding = 'utf-8') as srv:
2025-02-25 17:08:15.765 srv.info.get_log()
2025-02-25 17:08:15.773 fb_log_init = srv.readlines()
2025-02-25 17:08:15.781 # ----------------------------------------------------------------------------------------------
2025-02-25 17:08:15.787
2025-02-25 17:08:15.793 trace_cfg_items = [
2025-02-25 17:08:15.800 'log_connections = true',
2025-02-25 17:08:15.807 'log_transactions = true',
2025-02-25 17:08:15.814 'time_threshold = 0',
2025-02-25 17:08:15.821 'log_errors = true',
2025-02-25 17:08:15.827 'log_statement_finish = true',
2025-02-25 17:08:15.834 'log_trigger_finish = true',
2025-02-25 17:08:15.840 'max_sql_length = 32768',
2025-02-25 17:08:15.847 ]
2025-02-25 17:08:15.854
2025-02-25 17:08:15.860 with act.trace(db_events = trace_cfg_items, encoding='utf-8'):
2025-02-25 17:08:15.870 test_sql = f"""
2025-02-25 17:08:15.880 set names utf8;
2025-02-25 17:08:15.887 connect '{act.db.dsn}' user {tmp_worker.name} password '{tmp_worker.password}';
2025-02-25 17:08:15.894 quit;
2025-02-25 17:08:15.906 """
2025-02-25 17:08:15.917 act.isql(switches = ['-q'], input = test_sql, connect_db=False, credentials = False, combine_output = True, io_enc = 'utf-8')
2025-02-25 17:08:15.927 assert act.clean_stdout == act.clean_expected_stdout
2025-02-25 17:08:15.940 act.reset()
2025-02-25 17:08:15.952
2025-02-25 17:08:15.964 # ----------------------------------------------------------------------------------------------
2025-02-25 17:08:15.972
2025-02-25 17:08:15.985 allowed_patterns = \
2025-02-25 17:08:15.996 (
2025-02-25 17:08:16.005 re.escape(') FAILED EXECUTE_TRIGGER_FINISH')
2025-02-25 17:08:16.019 ,re.escape(') ERROR AT purge_attachment')
2025-02-25 17:08:16.032 ,re.escape('335544382 :') # name of exception: paramètre non trouvé (without quotes)
2025-02-25 17:08:16.045 ,re.escape('335545016 :') # message of exception: Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-02-25 17:08:16.055 ,re.escape('335544842 : At trigger')
2025-02-25 17:08:16.063 )
2025-02-25 17:08:16.079 allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ]
2025-02-25 17:08:16.094
2025-02-25 17:08:16.106 # Example of trace:
2025-02-25 17:08:16.120 # 2024-09-04T18:57:20.7950 (2184:00000000016B23C0) ERROR AT purge_attachment
2025-02-25 17:08:16.133 # ...
2025-02-25 17:08:16.145 # 335544517 : exception 1
2025-02-25 17:08:16.156 # 335544382 : paramètre non trouvé
2025-02-25 17:08:16.165 # 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-02-25 17:08:16.174 # 335544842 : At trigger 'gâchette de déconnexion' line: 5, col: 17
2025-02-25 17:08:16.184
2025-02-25 17:08:16.195 for line in act.trace_log:
2025-02-25 17:08:16.203 #print(line)
2025-02-25 17:08:16.211 if line.strip():
2025-02-25 17:08:16.220 if act.match_any(line.strip(), allowed_patterns):
2025-02-25 17:08:16.235 print(line.strip())
2025-02-25 17:08:16.247
2025-02-25 17:08:16.261 expected_trace_log = """
2025-02-25 17:08:16.272 FAILED EXECUTE_TRIGGER_FINISH
2025-02-25 17:08:16.284 ERROR AT purge_attachment
2025-02-25 17:08:16.292 335544382 : paramètre non trouvé
2025-02-25 17:08:16.301 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-02-25 17:08:16.306 335544842 : At trigger 'gâchette de déconnexion'
2025-02-25 17:08:16.312 """
2025-02-25 17:08:16.318 act.expected_stdout = expected_trace_log
2025-02-25 17:08:16.323 act.stdout = capsys.readouterr().out
2025-02-25 17:08:16.331 > assert act.clean_stdout == act.clean_expected_stdout
2025-02-25 17:08:16.342 E assert
2025-02-25 17:08:16.354 E FAILED EXECUTE_TRIGGER_FINISH
2025-02-25 17:08:16.361 E - ERROR AT purge_attachment
2025-02-25 17:08:16.368 E 335544382 : paramètre non trouvé
2025-02-25 17:08:16.381 E 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-02-25 17:08:16.395 E 335544842 : At trigger 'gâchette de déconnexion'
2025-02-25 17:08:16.408
2025-02-25 17:08:16.420 tests/functional/intl/test_non_ascii_firebird_and_trace_utf8.py:136: AssertionError
2025-02-25 17:08:16.433 ---------------------------- Captured stdout setup -----------------------------
2025-02-25 17:08:16.444 Creating db: localhost:/var/tmp/qa_2024/test_12069/test.fdb [page_size=None, sql_dialect=None, charset='UTF8', user=SYSDBA, password=masterkey]
2025-02-25 17:08:16.458 CREATE user: TMP_WORKER PLUGIN: Srp
2025-02-25 17:08:16.467 --------------------------- Captured stdout teardown ---------------------------
2025-02-25 17:08:16.475 DROP user: TMP_WORKER PLUGIN: Srp
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
tmp_worker = <firebird.qa.plugin.User pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.intl
@pytest.mark.trace
@pytest.mark.version('>=4.0')
def test_1(act: Action, tmp_worker: User, capsys):
init_sql = f"""
set list on;
set bail on;
create exception "paramètre non trouvé" q'#Paramètre "@1" a une valeur incorrecte ou n'a pas été trouvé dans#';
set term ^;
^
create trigger "gâchette de déconnexion" on disconnect as
begin
if ( current_user != '{act.db.user}' ) then
begin
exception "paramètre non trouvé" using ('fréquence fermée');
end
end
^
set term ;^
commit;
"""
#tmp_sql.write_bytes( bytes(init_sql.encode('utf-8')) )
#act.isql(switches=['-q'], input_file = tmp_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
act.expected_stdout = ''
act.isql(switches=['-q'], input = init_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
# ----------------------------------------------------------------------------------------------
with act.connect_server(encoding = 'utf-8') as srv:
srv.info.get_log()
fb_log_init = srv.readlines()
# ----------------------------------------------------------------------------------------------
trace_cfg_items = [
'log_connections = true',
'log_transactions = true',
'time_threshold = 0',
'log_errors = true',
'log_statement_finish = true',
'log_trigger_finish = true',
'max_sql_length = 32768',
]
with act.trace(db_events = trace_cfg_items, encoding='utf-8'):
test_sql = f"""
set names utf8;
connect '{act.db.dsn}' user {tmp_worker.name} password '{tmp_worker.password}';
quit;
"""
act.isql(switches = ['-q'], input = test_sql, connect_db=False, credentials = False, combine_output = True, io_enc = 'utf-8')
assert act.clean_stdout == act.clean_expected_stdout
act.reset()
# ----------------------------------------------------------------------------------------------
allowed_patterns = \
(
re.escape(') FAILED EXECUTE_TRIGGER_FINISH')
,re.escape(') ERROR AT purge_attachment')
,re.escape('335544382 :') # name of exception: paramètre non trouvé (without quotes)
,re.escape('335545016 :') # message of exception: Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
,re.escape('335544842 : At trigger')
)
allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ]
# Example of trace:
# 2024-09-04T18:57:20.7950 (2184:00000000016B23C0) ERROR AT purge_attachment
# ...
# 335544517 : exception 1
# 335544382 : paramètre non trouvé
# 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
# 335544842 : At trigger 'gâchette de déconnexion' line: 5, col: 17
for line in act.trace_log:
#print(line)
if line.strip():
if act.match_any(line.strip(), allowed_patterns):
print(line.strip())
expected_trace_log = """
FAILED EXECUTE_TRIGGER_FINISH
ERROR AT purge_attachment
335544382 : paramètre non trouvé
335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
335544842 : At trigger 'gâchette de déconnexion'
"""
act.expected_stdout = expected_trace_log
act.stdout = capsys.readouterr().out
> assert act.clean_stdout == act.clean_expected_stdout
E assert
E FAILED EXECUTE_TRIGGER_FINISH
E - ERROR AT purge_attachment
E 335544382 : paramètre non trouvé
E 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
E 335544842 : At trigger 'gâchette de déconnexion'
tests/functional/intl/test_non_ascii_firebird_and_trace_utf8.py:136: AssertionError
|