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-03-13 09:53:42.498
2025-03-13 09:53:42.503 act = <firebird.qa.plugin.Action object at [hex]>
2025-03-13 09:53:42.509 tmp_worker = <firebird.qa.plugin.User object at [hex]>
2025-03-13 09:53:42.514 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-03-13 09:53:42.520
2025-03-13 09:53:42.526 @pytest.mark.intl
2025-03-13 09:53:42.532 @pytest.mark.trace
2025-03-13 09:53:42.538 @pytest.mark.version('>=4.0')
2025-03-13 09:53:42.546 def test_1(act: Action, tmp_worker: User, capsys):
2025-03-13 09:53:42.553
2025-03-13 09:53:42.560 init_sql = f"""
2025-03-13 09:53:42.569 set list on;
2025-03-13 09:53:42.580 set bail on;
2025-03-13 09:53:42.589 create exception "paramètre non trouvé" q'#Paramètre "@1" a une valeur incorrecte ou n'a pas été trouvé dans#';
2025-03-13 09:53:42.596 set term ^;
2025-03-13 09:53:42.603 ^
2025-03-13 09:53:42.611 create trigger "gâchette de déconnexion" on disconnect as
2025-03-13 09:53:42.623 begin
2025-03-13 09:53:42.631 if ( current_user != '{act.db.user}' ) then
2025-03-13 09:53:42.639 begin
2025-03-13 09:53:42.648 exception "paramètre non trouvé" using ('fréquence fermée');
2025-03-13 09:53:42.663 end
2025-03-13 09:53:42.673 end
2025-03-13 09:53:42.681 ^
2025-03-13 09:53:42.688 set term ;^
2025-03-13 09:53:42.694 commit;
2025-03-13 09:53:42.700 """
2025-03-13 09:53:42.707
2025-03-13 09:53:42.713 #tmp_sql.write_bytes( bytes(init_sql.encode('utf-8')) )
2025-03-13 09:53:42.725 #act.isql(switches=['-q'], input_file = tmp_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2025-03-13 09:53:42.735
2025-03-13 09:53:42.743 act.expected_stdout = ''
2025-03-13 09:53:42.757 act.isql(switches=['-q'], input = init_sql, combine_output = True, charset = 'utf8', io_enc = 'utf-8')
2025-03-13 09:53:42.770 assert act.clean_stdout == act.clean_expected_stdout
2025-03-13 09:53:42.787 act.reset()
2025-03-13 09:53:42.803
2025-03-13 09:53:42.818 # ----------------------------------------------------------------------------------------------
2025-03-13 09:53:42.833 with act.connect_server(encoding = 'utf-8') as srv:
2025-03-13 09:53:42.845 srv.info.get_log()
2025-03-13 09:53:42.853 fb_log_init = srv.readlines()
2025-03-13 09:53:42.864 # ----------------------------------------------------------------------------------------------
2025-03-13 09:53:42.877
2025-03-13 09:53:42.889 trace_cfg_items = [
2025-03-13 09:53:42.899 'log_connections = true',
2025-03-13 09:53:42.907 'log_transactions = true',
2025-03-13 09:53:42.914 'time_threshold = 0',
2025-03-13 09:53:42.924 'log_errors = true',
2025-03-13 09:53:42.938 'log_statement_finish = true',
2025-03-13 09:53:42.952 'log_trigger_finish = true',
2025-03-13 09:53:42.967 'max_sql_length = 32768',
2025-03-13 09:53:42.981 ]
2025-03-13 09:53:42.993
2025-03-13 09:53:43.007 with act.trace(db_events = trace_cfg_items, encoding='utf-8'):
2025-03-13 09:53:43.018 test_sql = f"""
2025-03-13 09:53:43.031 set names utf8;
2025-03-13 09:53:43.045 connect '{act.db.dsn}' user {tmp_worker.name} password '{tmp_worker.password}';
2025-03-13 09:53:43.058 quit;
2025-03-13 09:53:43.074 """
2025-03-13 09:53:43.086 act.isql(switches = ['-q'], input = test_sql, connect_db=False, credentials = False, combine_output = True, io_enc = 'utf-8')
2025-03-13 09:53:43.100 assert act.clean_stdout == act.clean_expected_stdout
2025-03-13 09:53:43.113 act.reset()
2025-03-13 09:53:43.124
2025-03-13 09:53:43.136 # ----------------------------------------------------------------------------------------------
2025-03-13 09:53:43.149
2025-03-13 09:53:43.160 allowed_patterns = \
2025-03-13 09:53:43.169 (
2025-03-13 09:53:43.185 re.escape(') FAILED EXECUTE_TRIGGER_FINISH')
2025-03-13 09:53:43.196 ,re.escape(') ERROR AT purge_attachment')
2025-03-13 09:53:43.205 ,re.escape('335544382 :') # name of exception: paramètre non trouvé (without quotes)
2025-03-13 09:53:43.214 ,re.escape('335545016 :') # message of exception: Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-03-13 09:53:43.223 ,re.escape('335544842 : At trigger')
2025-03-13 09:53:43.229 )
2025-03-13 09:53:43.237 allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ]
2025-03-13 09:53:43.244
2025-03-13 09:53:43.251 # Example of trace:
2025-03-13 09:53:43.259 # 2024-09-04T18:57:20.7950 (2184:00000000016B23C0) ERROR AT purge_attachment
2025-03-13 09:53:43.265 # ...
2025-03-13 09:53:43.282 # 335544517 : exception 1
2025-03-13 09:53:43.295 # 335544382 : paramètre non trouvé
2025-03-13 09:53:43.308 # 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-03-13 09:53:43.317 # 335544842 : At trigger 'gâchette de déconnexion' line: 5, col: 17
2025-03-13 09:53:43.324
2025-03-13 09:53:43.331 for line in act.trace_log:
2025-03-13 09:53:43.338 #print(line)
2025-03-13 09:53:43.354 if line.strip():
2025-03-13 09:53:43.363 if act.match_any(line.strip(), allowed_patterns):
2025-03-13 09:53:43.371 print(line.strip())
2025-03-13 09:53:43.379
2025-03-13 09:53:43.385 expected_trace_log = """
2025-03-13 09:53:43.392 FAILED EXECUTE_TRIGGER_FINISH
2025-03-13 09:53:43.399 ERROR AT purge_attachment
2025-03-13 09:53:43.405 335544382 : paramètre non trouvé
2025-03-13 09:53:43.413 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-03-13 09:53:43.422 335544842 : At trigger 'gâchette de déconnexion'
2025-03-13 09:53:43.439 """
2025-03-13 09:53:43.453 act.expected_stdout = expected_trace_log
2025-03-13 09:53:43.464 act.stdout = capsys.readouterr().out
2025-03-13 09:53:43.474 > assert act.clean_stdout == act.clean_expected_stdout
2025-03-13 09:53:43.481 E assert
2025-03-13 09:53:43.487 E FAILED EXECUTE_TRIGGER_FINISH
2025-03-13 09:53:43.493 E - ERROR AT purge_attachment
2025-03-13 09:53:43.498 E 335544382 : paramètre non trouvé
2025-03-13 09:53:43.504 E 335545016 : Paramètre "fréquence fermée" a une valeur incorrecte ou n'a pas été trouvé dans
2025-03-13 09:53:43.509 E 335544842 : At trigger 'gâchette de déconnexion'
2025-03-13 09:53:43.515
2025-03-13 09:53:43.520 tests/functional/intl/test_non_ascii_firebird_and_trace_utf8.py:136: AssertionError
2025-03-13 09:53:43.526 ---------------------------- Captured stdout setup -----------------------------
2025-03-13 09:53:43.531 Creating db: localhost:/var/tmp/qa_2024/test_12072/test.fdb [page_size=None, sql_dialect=None, charset='UTF8', user=SYSDBA, password=masterkey]
2025-03-13 09:53:43.536 CREATE user: TMP_WORKER PLUGIN: Srp
2025-03-13 09:53:43.541 --------------------------- Captured stdout teardown ---------------------------
2025-03-13 09:53:43.547 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
|