GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Tests are run even when annotations are removed · Issue #1177 · utPLSQL/utPLSQL

Tests are run even when annotations are removed #1177

New issue
Copy link
New issue
Copy link
Closed
#1180
Closed
Tests are run even when annotations are removed#1177
#1180
Copy link
Assignees
lwasylow
Labels
bug
Milestone
v3.1.12

Description

@tredston
tredston
opened on Jan 11, 2022
Issue body actions

Describe the bug
Tests are not evicted from the caches when annotations are removed from packages.

Provide version info
oracle 19c
utplsql v3.1.10.3349

Information about client software
SQLDeveloper

To Reproduce
With utplsql2 and utplsql3 installed, run:

CREATE OR REPLACE PACKAGE UT_TESTS
AS
    --%suite
    
    --%test()
    PROCEDURE ut_test;
END;
/
CREATE OR REPLACE PACKAGE BODY UT_TESTS AS
 PROCEDURE ut_test IS
 BEGIN
   ut.expect(TRUE).to_be_true();
 END;
END;
/

set serverout on;
begin
ut.run('ut_tests');
end;
/

CREATE OR REPLACE PACKAGE UT_TESTS
AS
    PROCEDURE ut_test;
END;
/
CREATE OR REPLACE PACKAGE BODY UT_TESTS AS

 PROCEDURE ut_test IS
 BEGIN
   utAssert.eq('error', TRUE, TRUE);
 END;

END;
/
begin
ut.run('ut_tests');
end;
/

It produces the following error:

ut_tests
  ut_test [.004 sec] (FAILED - 1)
 
Failures:
 
  1) ut_test
      ORA-02291: integrity constraint (SYSTEM.UTR_ERROR_OUTCOME_FK) violated - parent key not found
      ORA-06512: at "SYSTEM.UTRERROR", line 149
      ORA-06512: at "SYSTEM.UTRERROR", line 103
      ORA-06512: at "SYSTEM.UTRERROR", line 324
      ORA-06512: at "SYSTEM.UTROUTCOME", line 146
      ORA-01400: cannot insert NULL into ("SYSTEM"."UTR_OUTCOME"."RUN_ID")
      ORA-06512: at "SYSTEM.UTROUTCOME", line 125
      ORA-06512: at "SYSTEM.UTRESULT2", line 75
      ORA-06512: at "SYSTEM.UTASSERT2", line 140
      ORA-06512: at "SYSTEM.UTASSERT2", line 604
      ORA-06512: at "SYSTEM.UTASSERT", line 141
      ORA-06512: at "DRIAD.UT_TESTS", line 5
      ORA-06512: at "SYSTEM.UTRERROR", line 149
      ORA-06512: at "SYSTEM.UTRERROR", line 103
      ORA-06512: at "SYSTEM.UTRERROR", line 324
      ORA-06512: at "SYSTEM.UTROUTCOME", line 146
      ORA-06512: at "SYSTEM.UTROUTCOME", line 125
      ORA-06512: at "SYSTEM.UTRESULT2", line 75
      ORA-06512: at "SYSTEM.UTASSERT2", line 140
      ORA-06512: at "SYSTEM.UTASSERT2", line 604
      ORA-06512: at "SYSTEM.UTASSERT", line 141
      ORA-06512: at "DRIAD.UT_TESTS", line 5
      ORA-06512: at line 6
Finished in .005519 seconds
1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)

Expected behavior
Packages without annotations should not be run as utplsql3 tests.

Additional context
We've run in to this while migrating from utplsqlv2 to v3 and it's causing failures in our CI system.

We have been performing the migration in a feature branch. However, tests we've updated to use v3 annotations in the feature branch are now failing in develop as they're picked up by ut.run() (due to being added to the annotation/suite caches by the feature branch) but the test body is still utplsql2.

Seems like ut_annotation_manager.get_sources_to_annotate should evict the objects to refresh if no sources are found.

Activity

  1. jgebal commented on Jan 11, 2022

    @jgebal
    jgebal
    on Jan 11, 2022
    Member
    More actions

    Are you're using our migration/bridge solution for v2-v3 migration?

    I also noticed that your utplsql v2 is installed in SYSTEM schema.
    This is really really dangerous.
    You should never put any code into SYSTEM schema.

    Having that said, I'll try to reproduce it on my local machine and see what the cause is.

    One key question is:
    Did you install utplsql v3 with DDL trigger or without?

  2. jgebal
    closed this as completedon Jan 11, 2022
  3. jgebal
    reopened this on Jan 11, 2022
  4. tredston commented on Jan 11, 2022

    @tredston
    tredston
    on Jan 11, 2022
    Author
    More actions

    We haven't been using the migration tool but will evaluate it going forward, thanks.

    Yeah, we are planning to remove v2 after the migration and it seems like wasted effort to move it to a different schema now. v3 is installed in its own user as recommended ;)

    We have the DDL trigger installed

  5. tredston commented on Jan 11, 2022

    @tredston
    tredston
    on Jan 11, 2022
    Author
    More actions

    I have a simplified test case:
    With utplsqlv3 + DDL trigger installed, run:

    CREATE OR REPLACE PACKAGE UT_TESTS
    AS
        --%suite
        
        --%test()
        PROCEDURE ut_test;
    END;
    /
    CREATE OR REPLACE PACKAGE BODY UT_TESTS AS
     PROCEDURE ut_test IS
     BEGIN
       ut.expect(TRUE).to_be_true();
     END;
    END;
    /
    
    set serverout on;
    begin
    ut.run('ut_tests');
    end;
    /
    
    CREATE OR REPLACE PACKAGE UT_TESTS
    AS
        
        PROCEDURE ut_test;
    END;
    /
    CREATE OR REPLACE PACKAGE BODY UT_TESTS AS
    
     PROCEDURE ut_test IS
     BEGIN
       null;
     END;
    
    END;
    /
    begin
    ut.run('ut_tests');
    end;
    /
    

    Which produces:

    
    Package UT_TESTS compiled
    
    
    Package Body UT_TESTS compiled
    
    ut_tests
      ut_test [.003 sec]
     
    Finished in .004088 seconds
    1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)
     
    
    
    PL/SQL procedure successfully completed.
    
    
    Package UT_TESTS compiled
    
    
    Package Body UT_TESTS compiled
    
    ut_tests
      ut_test [.003 sec]
     
    Finished in .00412 seconds
    1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)
     
    
    
    PL/SQL procedure successfully completed.
    

    I would expect the second run to have executed no tests as the package is not annotated as such.

  6. lwasylow commented on Jan 27, 2022

    @lwasylow
    lwasylow
    on Jan 27, 2022
    Member
    More actions

    @jgebal I had a quick look and seems like procedure ut_annotation_cache_manager.update_cache will remove data only when the l_cache_id is populated, however this not getting populated when event trigger is not null.
    The condition for rebuild based on trigger is removing only when action is DROP which is not necessary correct as we can see above. I think we need to also put a condition that there are no annotation and object is in cache should be removed.

  7. lwasylow
    linked a pull request that will close this issueAdding option to remove a cache for annotations on existing packag #1180on Jan 27, 2022
  8. lwasylow
    self-assigned this
    on Jan 27, 2022
  9. lwasylow
    added
    bugfix
    on Jan 27, 2022
  10. lwasylow
    closed this as completedin #1180on Jan 28, 2022
  11. jgebal
    added
    bug
    and removed
    bugfix
    on Feb 22, 2022
  12. jgebal
    added this to the 3.1.12 milestone on Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lwasylow
    lwasylow

Labels

bug

Type

No type

Projects

No projects

    Milestone

    • v3.1.12

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.