-
Notifications
You must be signed in to change notification settings - Fork 96
[#487] One SessionFactory per test class #683
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
Conversation
Well I think so, yes. I mean, I don't trust us to always write a |
hibernate-reactive-core/src/test/java/org/hibernate/reactive/BaseReactiveTest.java
Show resolved
Hide resolved
db7e697
to
4778d55
Compare
@blafond is having a look to see if we can find the name of the entities and create a default |
221a9a8
to
718b702
Compare
718b702
to
73c4226
Compare
Something doesn't work as expected on the latest JDKs. Note that, because I wanted to see the error message, I've changed the assertion for that specific run. The assertion failing is actually: Line 57 in 29733eb
It would be interesting to know why there is a different error. |
9f42ed8
to
eea05b3
Compare
I think this is ready to be merged now. If anything because it fixes some existing tests |
920a07d
to
7e6e596
Compare
Looks good. Clean implementation and provides test classes option to manage DB entities life cycle. |
7e6e596
to
9fe36dc
Compare
This way we can debug
In preparation of having a single factory per test class
Unless the entities define it, we cannot rely on the element order to check the content of a collection.
We will use it to handle a unique session factory for tests in the same class.
I've also refactored some because they would get stuck on some databases otherwise.
We don't really need it at the moment and having both dependencies on the classpath is a recipe for errors.
Additional test methods for when we need create an async before calling the method.
50a8a39
to
6b33c5a
Compare
The build is still failing on CI sometimes. I'm having a look |
ea7f97c
to
eec0364
Compare
* Make sure test actually runs * Remove unecessary local variables * Less strict check on the exception location
eec0364
to
0d3943e
Compare
Merged #683 We can tweak it later when problems occur. |
Fixes #487
Work on this with @blafond.
Now the test will create the factory once per test class. This saves some time with dbs like Db2 or CockroachDB.
The only issues I had is that some times tests get stuck but I couldn't figure out why. Refactoring some tests so that they now
use transaction solved the issues most of time.
@gavinking. do we really need to do this? The
cleanDb
method is called even when there is a failure. I suppose we could reset the factory if there is a problem deleting the entities but we don't have that many tests in a single class so I don't think it would be a problem. The reason I would prefer not to do it is because the only place I could do something like this is after thedeleteEntities
method has been called. I might thinkg of a better solution later.For some reasons, this test doesn't work with Db2: https://github.com/hibernate/hibernate-reactive/compare/main...DavideD:487-sf-per-class?expand=1#diff-659762d6654e6fae801ebfcf7577499a86f6799bd9ce7948922726acc994fbab
Unless I recreate the factory each time.
I've also removed JUnit 5, in the end we don't need it and having both dependencies on the classpath might only causes issues.
I might add it back in the future if they add an extension that's now missing in vertx-junit-5