Skip to content
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

Update to NH 5.2 #31

Merged
merged 9 commits into from
Apr 22, 2020
Merged

Conversation

jaykay-design
Copy link
Contributor

Fixes #28

All test pass.

The only changes done were using the refactored logging interface of NH 5.1 and later. Unfortunately this is not backwards compatible.

Please use this PR instead of PR#30 as PR#30 was made against my master branch.

@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@robdmoore
Copy link
Member

Nice. Looks like the build is working again. The problem now is the connection string to the database isn't working. That's probably because I upgraded the app veyor image we are using, which also changed the database version. cc @MattDavies

@robdmoore
Copy link
Member

robdmoore commented Apr 21, 2020

Ahhh I see why.

@jaykay-design do you mind change this file to swap 2014 with 2019 in your PR please? The build will suceed and I'll merge and release.

https://github.com/MRCollective/NHibernate.SqlAzure/blob/master/NHibernate5.SqlAzure.Tests/App.Release.config

@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@robdmoore
Copy link
Member

robdmoore commented Apr 21, 2020

OK getting closer. Looks like a bunch of tests passed and a bunch failed during test setup in the build logs.

There looks to be two cases (repeated a bunch of times):

SetUp Error : NHibernate.SqlAzure.Tests.WhenConnectingLocalTestingSqlAzureClientDriverShould
   SetUp : System.Data.SqlClient.SqlException : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at NHibernate.SqlAzure.Tests.Config.NHibernateTestBase`1.CreateTestDatabase() in C:\projects\nhibernate-sqlazure\NHibernate.SqlAzure.Tests\Config\NHibernateTestBase.cs:line 61
   at NHibernate.SqlAzure.Tests.Config.NHibernateTestBase`1.TestFixtureSetup() in C:\projects\nhibernate-sqlazure\NHibernate.SqlAzure.Tests\Config\NHibernateTestBase.cs:line 42

and

 SetUp Error : NHibernate.SqlAzure.Tests.LocalTestingSqlAzureClientDriverShould
   SetUp : System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger()
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling()
   at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration configuration)
   at NHibernate.SqlAzure.Tests.Config.NHibernateConfiguration`1.GetSessionFactory() in C:\projects\nhibernate-sqlazure\NHibernate.SqlAzure.Tests\Config\NHibernateConfiguration.cs:line 28
   at NHibernate.SqlAzure.Tests.Config.NHibernateTestBase`1.TestFixtureSetup() in C:\projects\nhibernate-sqlazure\NHibernate.SqlAzure.Tests\Config\NHibernateTestBase.cs:line 50
--NullReferenceException
   at HibernatingRhinos.Profiler.Appender.NHibernate3Logger.WrapNHibernateLogger.GetOriginalLoggerFactory()
   at HibernatingRhinos.Profiler.Appender.NHibernate3Logger.WrapNHibernateLogger.Initialize()

Not completely sure what the cause of those errors is. Migrations ran and some of the tests pass so it definitely worked to some extent.

@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@jaykay-design
Copy link
Contributor Author

jaykay-design commented Apr 21, 2020

I've updated NHibernateProfiler to 5.x as that version is compatible with NH5.1 onwards. I have no NHP license so I had that section commented out when running the tests locally.

Some test still fail in AppVeyor though.

I can see an SQLException about the server being paused and no connections are allowed. As I understand it, the tests use that method (pausing the server) so simulate connection failures, but, the associated error number (17142) is not handled in the SqlAzureTransientErrorDetectionStrategy.
Maybe this error code needs to be added to the error handling just to be able to handle the tests.

I'm not sure this is the best way to test though as existing connections would still be served by SQLServer (see this article). I have no alternative solution though.

I'm now updating my SQLServer Express instance to 2019 so I'll have the same environment as AppVeyor and maybe track this down the issue like that.

@jaykay-design
Copy link
Contributor Author

I've updated NHibernateProfiler to 5.x as that version is compatible with NH5.1 onwards. I have no NHP license so I had that section commented out when running the tests locally.

Some test still fail in AppVeyor though.

I can see an SQLException about the server being paused and no connections are allowed. As I understand it the tests use that (pausing the server) so simulate connection failures, but, the associated error number (17142) is not handled in the SqlAzureTransientErrorDetectionStrategy.
Maybe this error code needs to be added to the error handling just to be able to handle the tests.

I'm not sure this is the best way to test though as existing connections would still be served by SQLServer (see this article).

I'm now updating my SQLServer Express instance to 2019 so I'll have the same environment as AppVeyor and maybe track this down the issue like that.

@robdmoore
Copy link
Member

I always found the pausing to work well enough in the past at least. We can see the error logging that indicates it actually invokes the retry logic.

It's possible that the upgrade to 2019 has introduced a different error code for this circumstance so definitely worth adding that error code and seeing if it fixes it.

Good idea re: getting 2019 locally. Probably good to check it works against the latest version of SQL anyway!

Thanks for your efforts on this one :)

instead of pausing/resuming the server constantly with 20ms delay the server is now paused after 100ms and left in that state for 50ms. All tests run for at least one second so this should be enough to simulate a temporary outage.
@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@robdmoore
Copy link
Member

Nice! Getting close - only 1 error left (x 3 projects)

@AppVeyorBot
Copy link

1 similar comment
@AppVeyorBot
Copy link

@robdmoore
Copy link
Member

LYW! I like what you did.

@robdmoore robdmoore merged commit cf0d2f4 into MRCollective:master Apr 22, 2020
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.

Support for latest version of NHibernate
3 participants