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

Add TCK showing using external bundle (h2) and a pax warapped (sqlite) #273

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Dec 28, 2022

No description provided.

@github-actions
Copy link

github-actions bot commented Dec 28, 2022

Test Results

102 tests  +12   73 ✔️  -   8   2m 2s ⏱️ +9s
  52 suites +  2     9 💤 ±  0 
  52 files   +  2     8 +  8   12 🔥 +12 

For more details on these failures and errors, see this check.

Results for commit d658720. ± Comparison against base commit 89cf4e3.

This pull request removes 10 and adds 22 tests. Note that renamed tests count towards both.
org.ops4j.pax.jdbc.test.derby.DerbyDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.h2.H2DataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.h2.H2PooledDataSourceTest ‑ registerNativeDataSourceAndExpectPooledDataSource
org.ops4j.pax.jdbc.test.hsqldb.HsqldbDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.hsqldb.HsqldbNativeDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.jtds.JtdsDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.mariadb.MariaDbDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.mysql.MysqlDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.postgresql.PostgresqlDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.test.sqlite.SqliteDataSourceTest ‑ createDataSourceAndConnection
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testDeclaredCapabilities{ServiceReference}[1]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testDeclaredCapabilities{ServiceReference}[2]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testDeclaredCapabilities{ServiceReference}[3]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testDeclaredCapabilities{ServiceReference}[4]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testDeclaredCapabilities{ServiceReference}[5]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testRegisteredProperties{ServiceReference}[1]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testRegisteredProperties{ServiceReference}[2]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testRegisteredProperties{ServiceReference}[3]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testRegisteredProperties{ServiceReference}[4]
org.ops4j.pax.jdbc.tck.JdbcTckTest ‑ testRegisteredProperties{ServiceReference}[5]
…

♻️ This comment has been updated with latest results.

@laeubi laeubi force-pushed the add_tck_tests branch 4 times, most recently from 3358a43 to d042c8e Compare December 28, 2022 18:25
@grgrzybek
Copy link
Member

@laeubi the test failure is because Pax Exam tries to resolve just built artifacts, but the build workflow uses only mvn clean package and the artifacts are not available to any repository reachable from Pax Exam...

I'm not sure how it's usually handled with Github Actions (I didn't analyze much how it works - I guess we can't simply use mvn clean install to not fill out the disk space...).

@laeubi
Copy link
Member Author

laeubi commented Jan 2, 2023

I think clean install would be fine if it is required here!

@grgrzybek
Copy link
Member

Can mvn clean install be used with Github actions?

@grgrzybek
Copy link
Member

grgrzybek commented Jul 25, 2023

@laeubi I'm getting:

[INFO] Running org.ops4j.pax.jdbc.tck.JdbcTckTest
[ERROR] Tests run: 8, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.977 s <<< FAILURE! -- in org.ops4j.pax.jdbc.tck.JdbcTckTest
[ERROR] org.ops4j.pax.jdbc.tck.JdbcTckTest.testDeclaredCapabilities(ServiceReference)[1] -- Time elapsed: 0.134 s <<< FAILURE!
java.lang.AssertionError: 
[According to '125.2 Database Driver' a DataSourceFactory declaring the capability datasource must not throw any exception when invoking org.osgi.service.jdbc.DataSourceFactory.createDataSource(Properties) with a properties object containing the properties {user=usr, password=pswd, description=desc, dataSourceName=dsName, databaseName=dbName}] 
Expecting code not to raise a throwable but caught
  "java.sql.SQLFeatureNotSupportedException: The dataSourceName property is not supported by H2
	at org.h2.util.OsgiDataSourceFactory.rejectUnsupportedOptions(OsgiDataSourceFactory.java:170)
	at org.h2.util.OsgiDataSourceFactory.createDataSource(OsgiDataSourceFactory.java:64)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase$JdbcCapability.apply(JDBCTestCase.java:230)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase.lambda$testCapability$1(JDBCTestCase.java:181)
	at org.assertj.core.api.ThrowableAssert.catchThrowable(ThrowableAssert.java:63)
	at org.assertj.core.api.NotThrownAssert.isThrownBy(NotThrownAssert.java:43)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase.testCapability(JDBCTestCase.java:181)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase.testDeclaredCapabilities(JDBCTestCase.java:158)

...
[INFO] Running org.osgi.test.cases.jdbc.junit.JDBCTestCase
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.009 s <<< FAILURE! -- in org.osgi.test.cases.jdbc.junit.JDBCTestCase
[ERROR] org.osgi.test.cases.jdbc.junit.JDBCTestCase.testDeclaredCapabilities(ServiceReference) -- Time elapsed: 0 s <<< ERROR!
java.lang.IllegalStateException: No BundleContext available - The class (class org.osgi.test.cases.jdbc.junit.JDBCTestCase) must be loaded from a bundle
	at org.osgi.test.common.context.ContextHelper.getBundleContext(ContextHelper.java:33)
	at org.osgi.test.junit5.context.BundleContextExtension.lambda$getParentBundleContext$2(BundleContextExtension.java:97)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.osgi.test.junit5.context.BundleContextExtension.getParentBundleContext(BundleContextExtension.java:97)
	at org.osgi.test.junit5.context.BundleContextExtension.lambda$getBundleContext$0(BundleContextExtension.java:77)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$getOrComputeIfAbsent$4(ExtensionValuesStore.java:86)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.computeValue(ExtensionValuesStore.java:223)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.get(ExtensionValuesStore.java:211)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.evaluate(ExtensionValuesStore.java:191)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.access$100(ExtensionValuesStore.java:171)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:89)
	at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:93)
	at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:61)
	at org.osgi.test.junit5.context.BundleContextExtension.getBundleContext(BundleContextExtension.java:76)
...

@laeubi I've merged your pr and added some cleanup and pushed the result to https://github.com/ops4j/org.ops4j.pax.jdbc/commits/main-tck - you can check it there (mind that Symbolic Name for Maria DB driver has changed!). If you make it work, it'd be great ;)

@grgrzybek
Copy link
Member

For now, I'm releasing 1.5.6 but without this TCK addition.

@grgrzybek
Copy link
Member

Ah, looks like org.osgi.test.cases.jdbc.junit.JDBCTestCase should not be run - so I made it abstract.

@grgrzybek
Copy link
Member

So the only failure is:

[ERROR] Failures: 
[ERROR]   JdbcTckTest>JDBCTestCase.testDeclaredCapabilities:158->JDBCTestCase.testCapability:181 [According to '125.2 Database Driver' a DataSourceFactory declaring the capability datasource must not throw any exception when invoking org.osgi.service.jdbc.DataSourceFactory.createDataSource(Properties) with a properties object containing the properties {user=usr, password=pswd, description=desc, dataSourceName=dsName, databaseName=dbName}] 
Expecting code not to raise a throwable but caught
  "java.sql.SQLFeatureNotSupportedException: The dataSourceName property is not supported by H2
	at org.h2.util.OsgiDataSourceFactory.rejectUnsupportedOptions(OsgiDataSourceFactory.java:170)
	at org.h2.util.OsgiDataSourceFactory.createDataSource(OsgiDataSourceFactory.java:64)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase$JdbcCapability.apply(JDBCTestCase.java:230)
	at org.osgi.test.cases.jdbc.junit.JDBCTestCase.lambda$testCapability$1(JDBCTestCase.java:181)
...

But that's how your test works - it passes dataSourceName while H2 driver has org.h2.util.OsgiDataSourceFactory#rejectUnsupportedOptions() method:

/**
 * Checker method that will throw if any unsupported standard OSGi options
 * is present.
 *
 * @param p the properties to check
 * @throws SQLFeatureNotSupportedException if unsupported properties are
 *             present
 */
private static void rejectUnsupportedOptions(Properties p)
        throws SQLFeatureNotSupportedException {
    // Unsupported standard properties in OSGi
    if (p.containsKey(DataSourceFactory.JDBC_ROLE_NAME)) {
        throw new SQLFeatureNotSupportedException("The " +
                DataSourceFactory.JDBC_ROLE_NAME +
                " property is not supported by H2");
    }
    if (p.containsKey(DataSourceFactory.JDBC_DATASOURCE_NAME)) {
        throw new SQLFeatureNotSupportedException("The " +
                DataSourceFactory.JDBC_DATASOURCE_NAME +
                " property is not supported by H2");
    }
}

@laeubi
Copy link
Member Author

laeubi commented Jul 25, 2023

@grgrzybek I think there was some discussions about the test is asserting wron things, sadly we need to wait for the next release for this fixes to become "live" maybe we can still include the test but somehow keep in mind it is okay to fail (maybe just as a warning?).

@grgrzybek
Copy link
Member

I can move this module to a non-active profile called tck (just like in Pax Web), so it won't hold the release ;)

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

Successfully merging this pull request may close these issues.

2 participants