Skip to content

Make BytecodeEnhancedTestEngine non-discoverable by default #10491

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

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

Conversation

marko-bekhta
Copy link
Member

By removing the corresponding entry from the META-INF/services/org.junit.platform.engine.TestEngine we won't let JUnit pick up this engine by default, so in places like TCK or elsewhere where we do not need the @BytecodeEnhanced tests, we won't cause a problem if there is a JUnit version mismatch.
My concern is that this is a published jar, and this breaks the "original" behaviour 😖

@beikov WDYT?


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


by removing the corresponding entry from the  META-INF/services/org.junit.platform.engine.TestEngine
@hibernate-github-bot
Copy link

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [d06e41f]

› This message was automatically generated.

Copy link
Member

@mbellade mbellade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, are we sure the tests in hibernte-core are still picking up the extension when annotated with @BytecodeEnhanced? There's a failure on mariadb which might be related.

@marko-bekhta
Copy link
Member Author

Also, are we sure the tests in hibernte-core are still picking up the extension when annotated with @BytecodeEnhanced?

I sure hope so 😃, at least it shows it ok from the IDE, and if I run from the terminal with Gradle, I get:

Test	Method name	Duration	Result
testMerge(SessionFactoryScope)	testMerge(SessionFactoryScope)	0.656s	passed
Enhanced:testMerge(SessionFactoryScope)	testMerge(SessionFactoryScope)	0.008s	passed
Enhanced:testMerge2(SessionFactoryScope)	testMerge2(SessionFactoryScope)	0.055s	passed
testMerge2(SessionFactoryScope)	testMerge2(SessionFactoryScope)	0.010s	passed
Enhanced:testMerge3(SessionFactoryScope)	testMerge3(SessionFactoryScope)	0.013s	passed
testMerge3(SessionFactoryScope)	testMerge3(SessionFactoryScope)	0.012s	passed
testMerge4(SessionFactoryScope)	testMerge4(SessionFactoryScope)	0.007s	passed
Enhanced:testMerge4(SessionFactoryScope)	testMerge4(SessionFactoryScope)	0.007s	passed

so "all good" it seems. let me check that MySQL build...

@marko-bekhta
Copy link
Member Author

2025-07-08T17:26:35.1477678Z Enhanced:BytecodeEnhancementElementCollectionRecreateTest > Enhanced:testRecreateCollection(SessionFactoryScope) FAILED
2025-07-08T17:26:35.1479850Z     org.hibernate.exception.ConstraintViolationException: could not execute statement [(conn=78) Duplicate entry '1-0' for key 'PRIMARY'] [insert into myentity_elements (myentity_id,elements_ORDER,elements) values (?,?,?)]
2025-07-08T17:26:35.1481862Z         at app//org.hibernate.dialect.MariaDBDialect.lambda$buildSQLExceptionConversionDelegate$1(MariaDBDialect.java:377)
2025-07-08T17:26:35.1483390Z         at app//org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:34)
2025-07-08T17:26:35.1484731Z         at app//org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:115)
2025-07-08T17:26:35.1486147Z         at app//org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:193)
2025-07-08T17:26:35.1487815Z         at app//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.performNonBatchedMutation(AbstractMutationExecutor.java:148)
2025-07-08T17:26:35.1489948Z         at app//org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:53)
2025-07-08T17:26:35.1491878Z         at app//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:66)
2025-07-08T17:26:35.1493439Z         at app//org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:55)
2025-07-08T17:26:35.1495168Z         at app//org.hibernate.persister.collection.mutation.InsertRowsCoordinatorStandard.insertRows(InsertRowsCoordinatorStandard.java:115)
2025-07-08T17:26:35.1496966Z         at app//org.hibernate.persister.collection.BasicCollectionPersister.recreate(BasicCollectionPersister.java:103)
2025-07-08T17:26:35.1498388Z         at app//org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:53)
2025-07-08T17:26:35.1499532Z         at app//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:646)
2025-07-08T17:26:35.1500493Z         at app//org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:513)
2025-07-08T17:26:35.1501814Z         at app//org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:378)
2025-07-08T17:26:35.1503307Z         at app//org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
2025-07-08T17:26:35.1505145Z         at app//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:140)
2025-07-08T17:26:35.1556768Z         at app//org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1449)
2025-07-08T17:26:35.1557594Z         at app//org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:494)
2025-07-08T17:26:35.1558648Z         at app//org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2371)
2025-07-08T17:26:35.1559825Z         at app//org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2040)
2025-07-08T17:26:35.1561239Z         at app//org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:377)
2025-07-08T17:26:35.1563352Z         at app//org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:167)
2025-07-08T17:26:35.1566460Z         at app//org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commitNoRollbackOnly(JdbcResourceLocalTransactionCoordinatorImpl.java:249)
2025-07-08T17:26:35.1569695Z         at app//org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:243)
2025-07-08T17:26:35.1571936Z         at app//org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:90)
2025-07-08T17:26:35.1573264Z         at app//org.hibernate.testing.orm.transaction.TransactionUtil.wrapInTransaction(TransactionUtil.java:52)
2025-07-08T17:26:35.1574601Z         at app//org.hibernate.testing.orm.transaction.TransactionUtil.inTransaction(TransactionUtil.java:22)
2025-07-08T17:26:35.1576434Z         at app//org.hibernate.testing.orm.junit.SessionFactoryExtension$SessionFactoryScopeImpl.inTransaction(SessionFactoryExtension.java:371)
2025-07-08T17:26:35.1578216Z         at app//org.hibernate.testing.orm.junit.SessionFactoryExtension$SessionFactoryScopeImpl.inTransaction(SessionFactoryExtension.java:348)
2025-07-08T17:26:35.1580670Z         at org.hibernate.orm.test.annotations.collectionelement.recreate.BytecodeEnhancementElementCollectionRecreateTest.testRecreateCollection(BytecodeEnhancementElementCollectionRecreateTest.java:57)
2025-07-08T17:26:35.1582308Z 
2025-07-08T17:26:35.1582430Z         Caused by:
2025-07-08T17:26:35.1583283Z         java.sql.SQLIntegrityConstraintViolationException: (conn=78) Duplicate entry '1-0' for key 'PRIMARY'
2025-07-08T17:26:35.1584487Z             at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:297)
2025-07-08T17:26:35.1585710Z             at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:378)
2025-07-08T17:26:35.1586658Z             at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:187)
2025-07-08T17:26:35.1587594Z             at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:1364)
2025-07-08T17:26:35.1588596Z             at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:1303)
2025-07-08T17:26:35.1589695Z             at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:1222)
2025-07-08T17:26:35.1590767Z             at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:1146)
2025-07-08T17:26:35.1591917Z             at org.mariadb.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:87)
2025-07-08T17:26:35.1593217Z             at org.mariadb.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:307)
2025-07-08T17:26:35.1594446Z             at org.mariadb.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:284)
2025-07-08T17:26:35.1596209Z             at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:190)
2025-07-08T17:26:35.1597137Z             ... 26 more

since there's the enhanced prefix in the test ^ Enhanced:BytecodeEnhancementElementCollectionRecreateTest it means the engine was picked up and all is fine. So the problem is in the test itself ...

@mbellade
Copy link
Member

mbellade commented Jul 9, 2025

Great, not sure we're getting this failure here though, I'll re-run the checks.

But anyway, +1 from me to do this: I don't think we've advertised this feature being enabled anywhere, but I doubt anyone but us is using it in tests and expects it to be available by default.

@beikov
Copy link
Member

beikov commented Jul 10, 2025

Do we still have a problem with the JUnit version? It seems that running the JPA TCK works fine now, so unless it's broken, no touching :)

@marko-bekhta
Copy link
Member Author

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.

3 participants