Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added test to reproduce issue #985
  • Loading branch information
jgebal committed May 23, 2026
commit d22124bbd914e7b10e851122b6478ba498c7ec88
2 changes: 1 addition & 1 deletion .github/scripts/create_test_users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ PROMPT Grants for testing coverage outside of main $UT3_DEVELOP_SCHEMA schema.
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type,
select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table,
select any dictionary, create any synonym, drop any synonym,
grant any object privilege, grant any privilege, create public synonym, drop public synonym, create any trigger
grant any object privilege, grant any privilege, create public synonym, drop public synonym, create any trigger, drop any trigger
to UT3_TESTER_HELPER;

grant create job to UT3_TESTER_HELPER;
Expand Down
27 changes: 22 additions & 5 deletions test/ut3_tester/core/test_output_buffer.pkb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
create or replace package body test_output_buffer is

function long_text return varchar2 is
l_txt varchar2(32767);
begin
for i in 1 .. 100 loop
l_txt := l_txt||lpad('a text', 310, ',a text');
end loop;
return l_txt;
end;
procedure test_receive is
l_actual_text clob;
l_actual_item_type varchar2(1000);
Expand All @@ -10,10 +18,10 @@ create or replace package body test_output_buffer is
begin
--Arrange
l_buffer := ut3_develop.ut_output_clob_table_buffer();
l_expected_text := to_clob(lpad('a text', 31000, ',a text'))
|| chr(10) || to_clob(lpad('a text', 31000, ',a text'))
|| chr(13) || to_clob(lpad('a text', 31000, ',a text'))
|| chr(13) || chr(10) || to_clob(lpad('a text', 31000, ',a text')) || to_clob(lpad('a text', 31000, ',a text'));
l_expected_text := to_clob('a text') ||long_text()
|| chr(10) || long_text()
|| chr(13) || long_text()
|| chr(13) || chr(10) || long_text() || long_text();
l_expected_item_type := lpad('some item type',1000,'-');
--Act
l_buffer.lock_buffer();
Expand Down Expand Up @@ -196,5 +204,14 @@ create or replace package body test_output_buffer is
ut.expect(lengthb(l_text)).to_be_less_or_equal(l_max_len);
end;

end test_output_buffer;
procedure concurrent_calls_do_not_cause_exception is
l_consumer_buffer_instance ut3_develop.ut_output_buffer_base;
l_shared_output_id raw(32) := sys_guid();
begin
ut3_tester_helper.run_helper.run_as_job('declare x ut3_develop.ut_output_buffer_base; begin x := ut3_develop.ut_output_table_buffer(a_output_id => '''||l_shared_output_id||'''); end;');
dbms_session.sleep(0.5);
l_consumer_buffer_instance := ut3_develop.ut_output_table_buffer(a_output_id => l_shared_output_id);
end;

end test_output_buffer;
/
5 changes: 5 additions & 0 deletions test/ut3_tester/core/test_output_buffer.pks
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ create or replace package test_output_buffer is
--%test(Successfully sends multibyte long clob line into text buffer)
procedure text_buffer_send_clob_multib;

--%beforetest(ut3_tester_helper.run_helper.slow_down_insert_into_table_buffer)
--%aftertest(ut3_tester_helper.run_helper.cleanup_slow_down_insert_into_table_buffer)
--%test(concurrent calls to init() procedure do not cause errors - Issue #985)
procedure concurrent_calls_do_not_cause_exception;

end test_output_buffer;
/
38 changes: 36 additions & 2 deletions test/ut3_tester_helper/run_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ create or replace package body run_helper is
begin execute immediate 'drop package ut3_user.test_db_link'; exception when others then null; end;
end;

procedure create_suite_with_link is
procedure create_suite_with_link is
pragma autonomous_transaction;
begin
create_db_link;
Expand Down Expand Up @@ -250,7 +250,7 @@ create or replace package body run_helper is
execute immediate 'grant execute on test_distributed_savepoint to public';
end;

procedure drop_suite_with_link is
procedure drop_suite_with_link is
pragma autonomous_transaction;
begin
drop_db_link;
Expand Down Expand Up @@ -926,5 +926,39 @@ create or replace package body run_helper is
return l_result;
end;

procedure slow_down_insert_into_table_buffer is
pragma autonomous_transaction;
begin
execute immediate q'[
create or replace trigger ut3_develop.slow_down_buffer_insert
before insert on ut3_develop.ut_output_buffer_info_tmp
begin
dbms_session.sleep(1);
end;]';
end;

procedure cleanup_slow_down_insert_into_table_buffer is
pragma autonomous_transaction;
begin
execute immediate 'drop trigger ut3_develop.slow_down_buffer_insert';
exception when others then
if sqlcode <> -4080 then raise; end if;
end;

procedure run_as_job(a_job_action varchar2) is
l_job_name varchar2(50);
l_timestamp timestamp with time zone := current_timestamp;
pragma autonomous_transaction;
begin
l_job_name := 'utPLSQL__'||to_char(l_timestamp,'yyyymmddhh24missff');
dbms_scheduler.create_job(
job_name => l_job_name,
job_type => 'PLSQL_BLOCK',
job_action => a_job_action,
start_date => l_timestamp,
enabled => TRUE,
auto_drop => TRUE
);
end;
end;
/
5 changes: 5 additions & 0 deletions test/ut3_tester_helper/run_helper.pks
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,10 @@ create or replace package run_helper is
a_name varchar2 := null
) return sys_refcursor;

procedure slow_down_insert_into_table_buffer;

procedure cleanup_slow_down_insert_into_table_buffer;

procedure run_as_job(a_job_action varchar2);
end;
/
Loading