NH-4021 - enforce session tracking in tests #636
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NH-4021 - Track all opened session in tests
As illustrated with DtcFailuresFixture, some session "leaks" (indeed delayed releases) are going unnoticed due to the test by-passing the session tracking.
Adapt the base test class for ensuring this is no more possible, at least for sessions opened from session factory.
This is done by wrapping the session factory in delegating session factory. Some tests doing assumptions on the concrete session factory had to be adapted.
Lot of tests which were directly using the
TestBase
session factory field have been changed for using the property instead. Some tests which were changing the session factory were adapted too.This does not handle sessions opened from other sessions. It would require a similar wrapping, and much more tests could be impacted by it.