Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ORA-00001 returned before ut_coverage_html_reporter finished #1086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hehawe opened this issue Jun 29, 2020 · 10 comments · Fixed by #1091
Closed

ORA-00001 returned before ut_coverage_html_reporter finished #1086

hehawe opened this issue Jun 29, 2020 · 10 comments · Fixed by #1091
Assignees
Labels
Milestone

Comments

@hehawe
Copy link

hehawe commented Jun 29, 2020

Hi,
When I run something like
utPLSQL-cli/bin/utplsql run xxx/yyy@//zzz:1521/localpdb -c -f=ut_coverage_html_reporter -o=coverage.html
I get the following error

Successfully connected to database. UtPLSQL core: v3.1.10.3349
Oracle-Version: 18.0.0.0.0
Running tests now.

TestRunner initialized
Running on utPLSQL v3.1.10.3349
Initializing reporters
Running tests
ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 166
ORA-06512: at "UT3.UT_COVERAGE", line 235
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 35
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)

Am I doing something wrong or there's a bug?
I get the same result running ut_coverage_html_reporter in sql developer, so it's not related just to cli.

@pesse
Copy link
Member

pesse commented Jun 29, 2020

Can you try to uninstall and reinstall utPLSQL on your database?
Looks similar to #568 though this is long ago solved 🤔
@jgebal any ideas?

@jgebal
Copy link
Member

jgebal commented Jun 29, 2020

The issue shoul be moved to utPLSQL main project

@jgebal
Copy link
Member

jgebal commented Jun 29, 2020

This is really odd.
It seems like you have duplicate:
Owner/name/line amongst:
package body
trigger
type body
procedure
function

I didn't realize it's possible

@jgebal
Copy link
Member

jgebal commented Jun 29, 2020

Just checked. Trigger name can overlap with package or procedure or function name.

Can you check if this is duplicated in your case?
We need a fix in utPLSQL core code to fix it.

@hehawe
Copy link
Author

hehawe commented Jun 29, 2020

Can be at least the duplicate name identified?

I can also see the following:
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: Error : 1, Position : 0, Sql = BEGIN ut_runner.run(a_paths => :1 , a_reporters => :2 , a_color_console => (case :3 when 1 then true else false end), a_fail_on_errors => (case :4 when 1 then true else false end), a_client_character_set => :5 , a_random_test_order => (case :6 when 1 then true else false end));END;, OriginalSql = BEGIN ut_runner.run(a_paths => ?, a_reporters => ?, a_color_console => (case ? when 1 then true else false end), a_fail_on_errors => (case ? when 1 then true else false end), a_client_character_set => ?, a_random_test_order => (case ? when 1 then true else false end));END;, Error Msg = ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated

@hehawe
Copy link
Author

hehawe commented Jun 29, 2020

Even when I do just:

create or replace package testFunction_firstTest as
  --%suite(testSuite)

  --%test
  procedure firstTest;
end;
/
create or replace package body testFunction_firstTest as
    procedure firstTest
    is
    begin
        ut.expect( 1 ).to_equal( 1 );
    end;
end;
/

begin ut.run('testFunction_firstTest', ut_coverage_html_reporter()); end;

I got the same error

@jgebal jgebal transferred this issue from utPLSQL/utPLSQL-cli Jul 1, 2020
@jgebal jgebal added the bug label Jul 1, 2020
@jgebal
Copy link
Member

jgebal commented Jul 1, 2020

@hehawe
You can run the following query to identify duplicate object names that are causing this problem in your test run.

select 
       owner, object_name, 
       min(object_type) first_object_type, max(object_type) last_object_type, 
       count(1) duplicate_object_name_count
  from dba_objects
 where object_type in  ('PACAKGE BODY','TYPE BODY','PROCEDURE','FUNCTION','TRIGGER')
 group by owner, object_name
 having count(1) > 1
 order by owner, object_name

I've managed to reproduce the issue using the following steps:

create or replace package test_duplicate_name is
  procedure some_procedure;
end;

create or replace package body test_duplicate_name is
  procedure some_procedure is
  begin
    null;
  end;
end;
/

create table test_table (id integer);

create or replace trigger test_duplicate_name
  before insert on test_table
begin
  null;
end;

begin
  ut.run(ut_coverage_html_reporter());
end;

And I go the error as described:

ORA-00001: unique constraint (UT3.UT_COVERAGE_SOURCES_TMP_PK) violated
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "UT3.UT_COVERAGE_HELPER", line 37
ORA-06512: at "UT3.UT_COVERAGE", line 166
ORA-06512: at "UT3.UT_COVERAGE", line 235
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 35
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at "UT3.UT", line 134
ORA-06512: at "UT3.UT", line 488
ORA-06512: at "UT3.UT", line 558
ORA-06512: at line 2

Workaround for now

Rename duplicate objects.
It should be easiest to rename triggers as they should have no code depending on them and so the impact of rename should be zero.

Long-term, a fix is needed in utPLSQL to address this issue.

Should be relatively easy to fix now that we know what the cause is.

@hehawe
Copy link
Author

hehawe commented Jul 1, 2020

@jgebal

Hi Jacek,
Thanks for the workaround. We have a really big project, and yes, I could identify the duplicates. And there's a progress. However still with no success at the end. Now I have the following error:

ORA-19011: Character string buffer too small
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "SYS.DBMS_XMLGEN", line 19
ORA-06512: at "SYS.DBMS_XMLGEN", line 295
ORA-06512: at "UT3.UT_COVERAGE_REPORT_HTML_HELPER", line 190
ORA-06512: at "UT3.UT_COVERAGE_REPORT_HTML_HELPER", line 202
ORA-06512: at "UT3.UT_COVERAGE_REPORT_HTML_HELPER", line 334
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 37
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at "UT3.UT", line 134
ORA-06512: at "UT3.UT", line 488
ORA-06512: at "UT3.UT", line 623
ORA-06512: at line 1
19011. 00000 -  "Character string buffer too small" 
*Cause:    The string result asked for is too big to return back
*Action:   Get the result as a lob instead

Thanks for your effort,
HHW

@jgebal
Copy link
Member

jgebal commented Jul 1, 2020

Can you raise this as a separate issue please?
I will not be able to investigate it this week.
I'm on holidays

@jgebal jgebal added this to the 3.1.11 milestone Jul 18, 2020
@jgebal jgebal self-assigned this Jul 18, 2020
jgebal added a commit that referenced this issue Jul 18, 2020
Resolves #1086

TODO - need to fix coverage reporting so that coverage is grouped by object type not only object name
jgebal added a commit that referenced this issue Jul 20, 2020
Fixed issue with reporting non-block coverage as block coverage.
Resolves #1086
@jgebal
Copy link
Member

jgebal commented Oct 18, 2022

@hehawe
Your other problem was also identified now and will be fixed in version 3.1.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants