Tests - Drop OLD committed bx-derby; install bx-derby upon build
Description
The BoxLang Core repo relies on the bx-derby module to provide a packaged version of Apache Derby for most JDBC tests. This bx-derby version has previously been committed to the repository, but this causes numerous issues:
- The committed bx-derby version is old and out of date
- We are not testing updated versions of bx-derby
Hence, this PR updates the gradle build to install bx-derby during test compilation. The bx-derby module is then loaded into the boxlang runtime via a custom function in BaseJDBCTest.java.
Note we have special treatment here for bx-derby as it is the only DB driver required to run JDBC tests. The MySQL tests, MSSQL tests, etc. all use @EnableIf() to auto-disable if the module is present; whereas the vast majority JDBC tests rely on apache derby and do not use @EnableIf().
Checklist
- [X] My code follows the style guidelines of this project cfformat
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] New and existing unit tests pass locally with my changes
Feedback left in Slack. Also, please resolve any co-pilot comments above which are no longer relevant.
The dump failure can be resolved by rebasing with dev. There are still other failures, however.
I rebased against development and dropped all custom derby logic from the build.gradle. Seeing if tests pass.
@michaelborn status on this?
Ok, I'm stuck now on the setUp() and teardown methods in BaseJDBCTest. Both these methods expect a derby database to be available:
ortus.boxlang.runtime.types.exceptions.BoxRuntimeException: Unable to create datasource connection to URL [jdbc:derby:memory:0f0ba54a-4126-4547-99d0-0638b0c4d3d0;create=true] : Failed to get driver instance for jdbcUrl=jdbc:derby:memory:0f0ba54a-4126-4547-99d0-0638b0c4d3d0;create=true
at app//ortus.boxlang.runtime.jdbc.DataSource.<init>(DataSource.java:94)
at app//ortus.boxlang.runtime.jdbc.DataSource.fromStruct(DataSource.java:119)
at app//ortus.boxlang.runtime.jdbc.DataSource.fromStruct(DataSource.java:107)
at app//tools.JDBCTestUtils.constructTestDataSource(JDBCTestUtils.java:216)
at app//ortus.boxlang.runtime.bifs.global.jdbc.BaseJDBCTest.setUp(BaseJDBCTest.java:39)
Needs some thought on a path forward.
https://github.com/ortus-boxlang/BoxLang/blob/f5c7caf6d0f50168023935cbea4f8ca5efa03131/src/test/java/ortus/boxlang/runtime/bifs/global/jdbc/BaseJDBCTest.java#L39
Ready for review and merge, as long as this CI run passes with bx-derby installed.
Stuck on these test failures:
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | ortus.boxlang.runtime.types.exceptions.DatabaseException: Unable to read foreign key info
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | ortus.boxlang.runtime.types.exceptions.DatabaseException: Unable to read foreignkeys metadata
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | org.opentest4j.AssertionFailedError: Unexpected exception thrown: ortus.boxlang.runtime.types.exceptions.DatabaseException: No current connection.
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalStateException: Can't overwrite cause with java.sql.SQLTransientConnectionException: HikariPool-11 - Connection is not available, request timed out after 5000ms (total=13, active=13, idle=0, waiting=0)
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalStateException: Can't overwrite cause with java.sql.SQLTransientConnectionException: HikariPool-11 - Connection is not available, request timed out after 5000ms (total=13, active=13, idle=0, waiting=0)
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalStateException: Can't overwrite cause with java.sql.SQLTransientConnectionException: HikariPool-11 - Connection is not available, request timed out after 5000ms (total=13, active=13, idle=0, waiting=0)
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalStateException: Can't overwrite cause with java.sql.SQLTransientConnectionException: HikariPool-11 - Connection is not available, request timed out after 5000ms (total=13, active=13, idle=0, waiting=0)
🧪 - src/test/java/ortus/boxlang/runtime/components/jdbc/DBInfoTest.java | java.lang.IllegalStateException: Can't overwrite cause with java.sql.SQLTransientConnectionException: HikariPool-11 - Connection is not available, request timed out after 5000ms (total=13, active=13, idle=0, waiting=0)
🧪 - src/test/java/ortus/boxlang/runtime/services/DataSourceServiceTest.java | expected to be true
🧪 - src/test/java/ortus/boxlang/runtime/services/DataSourceServiceTest.java | expected to be true
🧪 - src/test/java/ortus/boxlang/runtime/services/DataSourceServiceTest.java | value of: getNames().asList().onlyElement()
🧪 - src/test/java/ortus/boxlang/runtime/services/DataSourceServiceTest.java | expected instance of: ortus.boxlang.runtime.jdbc.DataSource