You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2026/05/18 06:08:05 UTC
[PR] NoSQL: Fix persistence test extension resource resolution [polaris]
snazy opened a new pull request, #4472:
URL: https://github.com/apache/polaris/pull/4472
Fix the test extension so it resolves resources from the actual test context instead of whichever class loader happens to win.
The old lookup was brittle and made the extension sensitive to execution environment and module layout.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix persistence test extension resource resolution [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4472:
URL: https://github.com/apache/polaris/pull/4472#discussion_r3267946679
##########
persistence/nosql/persistence/testextension/src/main/java/org/apache/polaris/persistence/nosql/testextension/PersistenceTestExtension.java:
##########
@@ -165,11 +165,11 @@ public boolean supportsParameter(
}
private void assertValidFieldCandidate(Field field) {
- if (!field.getType().isAssignableFrom(SnowflakeIdGenerator.class)
- && !field.getType().isAssignableFrom(MonotonicClock.class)
- && !field.getType().isAssignableFrom(Persistence.class)
- && !field.getType().isAssignableFrom(Backend.class)
- && !field.getType().isAssignableFrom(BackendTestFactory.class)) {
+ if (!IdGenerator.class.isAssignableFrom(field.getType())
+ && !MonotonicClock.class.isAssignableFrom(field.getType())
Review Comment:
I believe we should be able to do `targetType.isAssignableFrom(declaredProducedType)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix persistence test extension resource resolution [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4472:
URL: https://github.com/apache/polaris/pull/4472#discussion_r3267203203
##########
persistence/nosql/persistence/testextension/src/main/java/org/apache/polaris/persistence/nosql/testextension/PersistenceTestExtension.java:
##########
@@ -165,11 +165,11 @@ public boolean supportsParameter(
}
private void assertValidFieldCandidate(Field field) {
- if (!field.getType().isAssignableFrom(SnowflakeIdGenerator.class)
- && !field.getType().isAssignableFrom(MonotonicClock.class)
- && !field.getType().isAssignableFrom(Persistence.class)
- && !field.getType().isAssignableFrom(Backend.class)
- && !field.getType().isAssignableFrom(BackendTestFactory.class)) {
+ if (!IdGenerator.class.isAssignableFrom(field.getType())
+ && !MonotonicClock.class.isAssignableFrom(field.getType())
Review Comment:
This extension actually produces a `MonotonicClock` (among other types here) and JUnit will assign that value to the field.... so the old check looks correct to me 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix persistence test extension resource resolution [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy merged PR #4472:
URL: https://github.com/apache/polaris/pull/4472
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix persistence test extension resource resolution [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4472:
URL: https://github.com/apache/polaris/pull/4472#discussion_r3267897304
##########
persistence/nosql/persistence/testextension/src/main/java/org/apache/polaris/persistence/nosql/testextension/PersistenceTestExtension.java:
##########
@@ -120,10 +121,10 @@ public Object resolveParameter(
private Object resolve(
PolarisPersistence annotation, Class<?> type, ExtensionContext extensionContext) {
- if (MonotonicClock.class.isAssignableFrom(type)) {
+ if (MonotonicClock.class == type) {
return getOrCreateMonotonicClock(extensionContext);
}
- if (IdGenerator.class.isAssignableFrom(type)) {
+ if (IdGenerator.class == type || SnowflakeIdGenerator.class == type) {
Review Comment:
nit: Why not `type.isAssignableFrom(SnowflakeIdGenerator.class)`? I believe that would fit the overall parameter injection logic better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NoSQL: Fix persistence test extension resource resolution [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #4472:
URL: https://github.com/apache/polaris/pull/4472#discussion_r3267871289
##########
persistence/nosql/persistence/testextension/src/main/java/org/apache/polaris/persistence/nosql/testextension/PersistenceTestExtension.java:
##########
@@ -165,11 +165,11 @@ public boolean supportsParameter(
}
private void assertValidFieldCandidate(Field field) {
- if (!field.getType().isAssignableFrom(SnowflakeIdGenerator.class)
- && !field.getType().isAssignableFrom(MonotonicClock.class)
- && !field.getType().isAssignableFrom(Persistence.class)
- && !field.getType().isAssignableFrom(Backend.class)
- && !field.getType().isAssignableFrom(BackendTestFactory.class)) {
+ if (!IdGenerator.class.isAssignableFrom(field.getType())
+ && !MonotonicClock.class.isAssignableFrom(field.getType())
Review Comment:
Well, yes and no. And also no to that the fix here as you reviewed is correct.
Honestly, any `isAssignableFrom` is wrong, especially considering what `resolve()` does.
The underlying issue is that the instances produced for parameters and fields are created from factories.
So technically we would have to do an `isAssignableFrom` against the actually produced type. But those produced instances already allocate resources, which is a bit heavy for a simple "supports this parameter type" check.
So I took the easy route and replaced the `isAssignableFrom` checks with a straight `==` against the `Class`es, which is fine for the current tests. If we need more later, we can add it. But this approach feels much safer - and it's for tests, failing early and hard is fine there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org