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:
2024-10-16 06:02:37.241
2024-10-16 06:02:37.246 act = <firebird.qa.plugin.Action object at [hex]>
2024-10-16 06:02:37.253 tmp_worker = <firebird.qa.plugin.User object at [hex]>
2024-10-16 06:02:37.263 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-10-16 06:02:37.268
2024-10-16 06:02:37.273 @pytest.mark.trace
2024-10-16 06:02:37.278 @pytest.mark.version('>=4.0')
2024-10-16 06:02:37.282 def test_1(act: Action, tmp_worker: User, capsys):
2024-10-16 06:02:37.288
2024-10-16 06:02:37.293 init_sql = f"""
2024-10-16 06:02:37.298 set list on;
2024-10-16 06:02:37.302 set bail on;
2024-10-16 06:02:37.308 create exception "paramètre non trouvé" q'#Paramètre "@1" a une valeur incorrecte ou n'a pas été trouvé dans#';
2024-10-16 06:02:37.312 set term ^;
2024-10-16 06:02:37.317 ^
2024-10-16 06:02:37.323 create trigger "gâchette de déconnexion" on disconnect as
2024-10-16 06:02:37.329 begin
2024-10-16 06:02:37.335 if ( current_user != '{act.db.user}' ) then
2024-10-16 06:02:37.343 begin
2024-10-16 06:02:37.350 exception "paramètre non trouvé" using ('fréquence fermée');
2024-10-16 06:02:37.356 end
2024-10-16 06:02:37.361 end
2024-10-16 06:02:37.366 ^
2024-10-16 06:02:37.372 set term ;^
2024-10-16 06:02:37.379 commit;
2024-10-16 06:02:37.386 """
2024-10-16 06:02:37.391
2024-10-16 06:02:37.396 #tmp_sql.write_bytes( bytes(init_sql.encode('utf-8')) )
2024-10-16 06:02:37.402 #act.isql(switches=['-q'], input_file = tmp_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2024-10-16 06:02:37.407
2024-10-16 06:02:37.412 act.expected_stdout = ''
2024-10-16 06:02:37.420 act.isql(switches=['-q'], input = init_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2024-10-16 06:02:37.427 assert act.clean_stdout == act.clean_expected_stdout
2024-10-16 06:02:37.431 act.reset()
2024-10-16 06:02:37.436
2024-10-16 06:02:37.441 # ----------------------------------------------------------------------------------------------
2024-10-16 06:02:37.446 with act.connect_server(encoding = 'utf-8') as srv:
2024-10-16 06:02:37.450 srv.info.get_log()
2024-10-16 06:02:37.456 fb_log_init = srv.readlines()
2024-10-16 06:02:37.460 # ----------------------------------------------------------------------------------------------
2024-10-16 06:02:37.465
2024-10-16 06:02:37.470 trace_cfg_items = [
2024-10-16 06:02:37.475 'log_connections = true',
2024-10-16 06:02:37.480 'log_transactions = true',
2024-10-16 06:02:37.486 'time_threshold = 0',
2024-10-16 06:02:37.490 'log_errors = true',
2024-10-16 06:02:37.495 'log_statement_finish = true',
2024-10-16 06:02:37.500 'log_trigger_finish = true',
2024-10-16 06:02:37.505 'max_sql_length = 32768',
2024-10-16 06:02:37.510 ]
2024-10-16 06:02:37.514
2024-10-16 06:02:37.519 with act.trace(db_events = trace_cfg_items, encoding='utf-8'):
2024-10-16 06:02:37.523 test_sql = f"""
2024-10-16 06:02:37.527 set names utf8;
2024-10-16 06:02:37.531 connect '{act.db.dsn}' user {tmp_worker.name} password '{tmp_worker.password}';
2024-10-16 06:02:37.536 quit;
2024-10-16 06:02:37.540 """
2024-10-16 06:02:37.544 act.isql(switches = ['-q'], input = test_sql, connect_db=False, credentials = False, combine_output = True, io_enc = 'utf-8')
2024-10-16 06:02:37.549 assert act.clean_stdout == act.clean_expected_stdout
2024-10-16 06:02:37.553 act.reset()
2024-10-16 06:02:37.557
2024-10-16 06:02:37.562 # ----------------------------------------------------------------------------------------------
2024-10-16 06:02:37.567
2024-10-16 06:02:37.571 allowed_patterns = \
2024-10-16 06:02:37.576 (
2024-10-16 06:02:37.580 re.escape(') FAILED EXECUTE_TRIGGER_FINISH')
2024-10-16 06:02:37.585 ,re.escape(') ERROR AT purge_attachment')
2024-10-16 06:02:37.590 ,re.escape('335544382 :') # name of exception: paramètre non trouvé (without quotes)
2024-10-16 06:02:37.594 ,re.escape('335545016 :') # message of exception: Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2024-10-16 06:02:37.599 ,re.escape('335544842 : At trigger')
2024-10-16 06:02:37.604 )
2024-10-16 06:02:37.608 allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ]
2024-10-16 06:02:37.613
2024-10-16 06:02:37.618 # Example of trace:
2024-10-16 06:02:37.623 # 2024-09-04T18:57:20.7950 (2184:00000000016B23C0) ERROR AT purge_attachment
2024-10-16 06:02:37.628 # ...
2024-10-16 06:02:37.633 # 335544517 : exception 1
2024-10-16 06:02:37.638 # 335544382 : paramètre non trouvé
2024-10-16 06:02:37.642 # 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2024-10-16 06:02:37.647 # 335544842 : At trigger 'gâchette de déconnexion' line: 5, col: 17
2024-10-16 06:02:37.651
2024-10-16 06:02:37.656 for line in act.trace_log:
2024-10-16 06:02:37.660 #print(line)
2024-10-16 06:02:37.665 if line.strip():
2024-10-16 06:02:37.670 if act.match_any(line.strip(), allowed_patterns):
2024-10-16 06:02:37.675 print(line.strip())
2024-10-16 06:02:37.680
2024-10-16 06:02:37.684 expected_trace_log = """
2024-10-16 06:02:37.689 FAILED EXECUTE_TRIGGER_FINISH
2024-10-16 06:02:37.694 ERROR AT purge_attachment
2024-10-16 06:02:37.699 335544382 : paramètre non trouvé
2024-10-16 06:02:37.704 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2024-10-16 06:02:37.709 335544842 : At trigger 'gâchette de déconnexion'
2024-10-16 06:02:37.713 """
2024-10-16 06:02:37.718 act.expected_stdout = expected_trace_log
2024-10-16 06:02:37.723 act.stdout = capsys.readouterr().out
2024-10-16 06:02:37.728 > assert act.clean_stdout == act.clean_expected_stdout
2024-10-16 06:02:37.733 E assert
2024-10-16 06:02:37.738 E FAILED EXECUTE_TRIGGER_FINISH
2024-10-16 06:02:37.742 E - ERROR AT purge_attachment
2024-10-16 06:02:37.747 E 335544382 : paramètre non trouvé
2024-10-16 06:02:37.752 E 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2024-10-16 06:02:37.756 E 335544842 : At trigger 'gâchette de déconnexion'
2024-10-16 06:02:37.760
2024-10-16 06:02:37.764 tests/functional/intl/test_non_ascii_firebird_and_trace_utf8.py:135: AssertionError
2024-10-16 06:02:37.769 ---------------------------- Captured stdout setup -----------------------------
2024-10-16 06:02:37.773 Creating db: localhost:/var/tmp/qa_2024/test_12054/test.fdb [page_size=None, sql_dialect=None, charset='UTF8', user=SYSDBA, password=masterkey]
2024-10-16 06:02:37.778 CREATE user: TMP_WORKER PLUGIN: Srp
2024-10-16 06:02:37.786 --------------------------- Captured stdout teardown ---------------------------
2024-10-16 06:02:37.794 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.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:135: AssertionError
|