Skip to content
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

Run CI with GitHub Actions to support Oracle database 18c #198

Merged
merged 3 commits into from Aug 5, 2021

Commits on Aug 4, 2021

  1. Run CI with GitHub Actions

    - Run Oracle Database 18c
    - Only CRuby versions executed since due to rsim#176
    - No Active Record matrix added yet
    yahonda committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    f9bc2a8 View commit details
    Browse the repository at this point in the history
  2. Use dbms_session.sleep for Oracle Database 18c or higher

    dbms_lock.sleep is also supported which requires explicit
    grant statement executed like 'grant execute on sys.dbms_lock to hr'.
    
    dbms_session.sleep can be executed without additional grant statement,
    which is convenient for CI environments.
    
    Refer
    https://docs.oracle.com/en/database/oracle/oracle-database/18/arpls/DBMS_SESSION.html#GUID-27CCC2F7-6564-41D2-8C42-CFFBF25A69B5
    https://oracle-base.com/articles/18c/dbms_session-sleep-18c
    yahonda committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    58a7272 View commit details
    Browse the repository at this point in the history
  3. Skip "using Oracle 9.2" for Oracle Database 18c or higher

    Without this skip, this spec will fail as follows.
    
    ```
    Failures:
    
      1) Parameter type mapping / Function with table indexed by bynary integer parameter using Oracle 9.2 should create temporary tables when using Oracle 9.2
         Failure/Error: case element_metadata[:data_type]
    
         NoMethodError:
           undefined method `[]' for nil:NilClass
         # ./lib/plsql/procedure.rb:314:in `block in ensure_tmp_tables_created'
         # ./lib/plsql/procedure.rb:311:in `each'
         # ./lib/plsql/procedure.rb:311:in `ensure_tmp_tables_created'
         # ./lib/plsql/procedure_call.rb:15:in `initialize'
         # ./lib/plsql/procedure.rb:545:in `new'
         # ./lib/plsql/procedure.rb:545:in `exec'
         # ./lib/plsql/package.rb:67:in `method_missing'
         # ./spec/plsql/procedure_spec.rb:1522:in `block (4 levels) in <top (required)>'
    
    Finished in 44.29 seconds (files took 0.56531 seconds to load)
    453 examples, 1 failure, 3 pending
    
    Failed examples:
    
    rspec ./spec/plsql/procedure_spec.rb:1521 # Parameter type mapping / Function with table indexed by bynary integer parameter using Oracle 9.2 should create temporary tables when using Oracle 9.2
    ```
    
    Here is the reason why:
    This spec simulates the connection as if it connects to Oracle database 9.2.
    
    https://github.com/rsim/ruby-plsql/blob/4c336819759d08c076eb0c351620f21eb5225161/spec/plsql/procedure_spec.rb#L1512-L1514
    
    ```ruby
     # simulate Oracle 9.2 connection
     plsql(:oracle_9).connection = get_connection
     allow(plsql(:oracle_9).connection).to receive(:database_version).and_return([9, 2, 0, 0])
    ```
    
    Then `get_argument_metadata` executes `get_argument_metadata_below_18c`.
    
    https://github.com/rsim/ruby-plsql/blob/4c336819759d08c076eb0c351620f21eb5225161/lib/plsql/procedure.rb#L85-L91
    
    ```ruby
     def get_argument_metadata #:nodoc:
       if (@schema.connection.database_version <=> [18, 0, 0, 0]) >= 0
         get_argument_metadata_from_18c
       else
         get_argument_metadata_below_18c
       end
     end
    ```
    
    Both `get_argument_metadata_from_18c` and `get_argument_metadata_below_18c` methods depend on each Oracle database dictionary implentation then only mocking database version is not enough.
    yahonda committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    c057935 View commit details
    Browse the repository at this point in the history