Skip to content

NH-4021 - enforce session tracking in tests #636

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

Merged
merged 3 commits into from
Jun 2, 2017

Conversation

fredericDelaporte
Copy link
Member

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.

private ConcurrentBag<ISession> _openedSessions = new ConcurrentBag<ISession>();
private ISession _lastOpenedSession;
private DebugConnectionProvider connectionProvider;
protected bool IsAntlrParser => Sfi.Settings.QueryTranslatorFactory is ASTQueryTranslatorFactory;
Copy link
Member

Choose a reason for hiding this comment

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

This is always true

Copy link
Member Author

Choose a reason for hiding this comment

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

Was thinking it was very likely obsolete, but had not checked. Thanks for the cleanup.

@hazzik hazzik merged commit b13c5b8 into nhibernate:master Jun 2, 2017
@fredericDelaporte fredericDelaporte deleted the NH-4021 branch June 2, 2017 12:41
@fredericDelaporte fredericDelaporte added this to the 5.0.0 milestone Jun 2, 2017
@hazzik hazzik added the r: Fixed label Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants