6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_3095_test.py

51 lines
1.3 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3474
ISSUE: 3474
TITLE: Client receive event's with count equal to 1 despite of how many times EVENT was POSTed in same transaction
DESCRIPTION:
We create stored procedure as it was specified in the ticket, and call it with input arg = 3.
This mean that we have to receive THREE events after code which calls this SP will issue COMMIT.
JIRA: CORE-3095
FBTEST: bugs.core_3095
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
set term ^;
create or alter procedure sp_test (a_evt_count int) as
begin
while (a_evt_count > 0) do
begin
post_event('loop');
a_evt_count = a_evt_count - 1;
end
end
^
set term ;^
commit;
2021-11-16 19:44:53 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-11-16 19:44:53 +01:00
{'loop': 3}
"""
2021-04-26 20:07:00 +02:00
2021-11-16 19:44:53 +01:00
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action, capsys):
act.expected_stdout = expected_stdout
with act.db.connect() as con:
2021-11-16 19:44:53 +01:00
c = con.cursor()
with con.event_collector(['loop']) as events:
c.execute('execute procedure sp_test(3)')
con.commit()
print(events.wait(10))
2022-01-22 21:59:15 +01:00
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout