Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-7594

@JUnitTemporaryDatabase tests do not use connection pooling

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.10.0
    • Fix Version/s: 15.0.2
    • Component/s: Testing / JUnit
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None

      Description

      When we use @JUnitTemporaryDatabase in unit tests, our temporary PostgreSQL database calls DataSourceFactory.setInstance(database) to set itself as the default javax.sql.DataSource. However, this means that there is no connection pooling using c3p0 during the unit tests. This is leading to socket exceptions during some database-intensive unit tests because hundreds of database connections are being opened and closed quickly enough to exhaust the available ephemeral client ports.

      We need to change TemporaryDatabaseExecutionListener to wrap the datasource in a c3p0 pool.

      This probably isn't an issue with atomikos since its javax.sql.DataSource is implemented using a pooled javax.sql.XADataSource resource.

        Attachments

          Activity

            People

            • Assignee:
              seth Seth Leger
              Reporter:
              seth Seth Leger
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: