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

Fix flaky tests #3031

Open
MichelZ opened this issue Nov 21, 2024 · 0 comments
Open

Fix flaky tests #3031

MichelZ opened this issue Nov 21, 2024 · 0 comments
Labels
Area\Tests Issues that are targeted to tests or test projects ✔️ Triage Done Issues that are triaged by dev team and are in investigation.

Comments

@MichelZ
Copy link
Contributor

MichelZ commented Nov 21, 2024

The following tests fail from time to time and should be considered "flaky" and investigated:

ConnectionExceptionTest.TestConnectionStateWithErrorClass20

This test has failed for me a couple of times with:


 [xUnit.net 00:00:57.04]     Microsoft.Data.SqlClient.ManualTesting.Tests.ConnectionExceptionTest.TestConnectionStateWithErrorClass20 [FAIL]
  [xUnit.net 00:00:57.04]       Assert.Equal() Failure: Values differ
  [xUnit.net 00:00:57.04]       Expected: 11
  [xUnit.net 00:00:57.04]       Actual:   20
  [xUnit.net 00:00:57.04]       Stack Trace:
  [xUnit.net 00:00:57.04]         /_/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs(43,0): at Microsoft.Data.SqlClient.ManualTesting.Tests.ConnectionExceptionTest.TestConnectionStateWithErrorClass20()
  [xUnit.net 00:00:57.04]            at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
  [xUnit.net 00:00:57.04]            at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    Failed Microsoft.Data.SqlClient.ManualTesting.Tests.ConnectionExceptionTest.TestConnectionStateWithErrorClass20 [2 s]
##[error]EXEC(0,0): Error Message: 
EXEC : error Message:  [D:\a\_work\1\s\build.proj]
     Assert.Equal() Failure: Values differ
  Expected: 11
  Actual:   20
    Stack Trace:
       at Microsoft.Data.SqlClient.ManualTesting.Tests.ConnectionExceptionTest.TestConnectionStateWithErrorClass20() in /_/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs:line 43
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
     at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

EventCounterTest.EventCounter_ReclaimedConnectionsCounter_Functional

This one also fails frequently with a timeout, I don't know why though. Even after increasing the timeout to 30 seconds it still fails sometimes

 [xUnit.net 00:05:41.75]     Microsoft.Data.SqlClient.ManualTesting.Tests.EventCounterTest.EventCounter_ReclaimedConnectionsCounter_Functional [FAIL]
  [xUnit.net 00:05:41.75]       System.InvalidOperationException : Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
  [xUnit.net 00:05:41.75]       Stack Trace:
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionFactory.cs(319,0): at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs(963,0): at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionClosed.cs(43,0): at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs(1970,0): at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs(1413,0): at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs(1390,0): at Microsoft.Data.SqlClient.SqlConnection.Open()
  [xUnit.net 00:05:41.75]         /_/src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/EventCounterTest.cs(167,0): at Microsoft.Data.SqlClient.ManualTesting.Tests.EventCounterTest.EventCounter_ReclaimedConnectionsCounter_Functional()
  [xUnit.net 00:05:41.75]            at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
  [xUnit.net 00:05:41.75]            at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
    Failed Microsoft.Data.SqlClient.ManualTesting.Tests.EventCounterTest.EventCounter_ReclaimedConnectionsCounter_Functional [30 s]
##[error]EXEC(0,0): Error Message: 
EXEC : error Message:  [D:\a\_work\1\s\build.proj]
     System.InvalidOperationException : Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
    Stack Trace:
       at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) in /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionFactory.cs:line 319
     at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs:line 963
     at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) in /_/src/Microsoft.Data.SqlClient/src/Microsoft/Data/ProviderBase/DbConnectionClosed.cs:line 43
     at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs:line 1970
     at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs:line 1413
     at Microsoft.Data.SqlClient.SqlConnection.Open() in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs:line 1390
     at Microsoft.Data.SqlClient.ManualTesting.Tests.EventCounterTest.EventCounter_ReclaimedConnectionsCounter_Functional() in /_/src/Microsoft.Data.SqlClient/tests/ManualTests/TracingTests/EventCounterTest.cs:line 167
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
     at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

MichelZ added a commit to MichelZ/SqlClient that referenced this issue Nov 24, 2024
@cheenamalhotra cheenamalhotra added ✔️ Triage Done Issues that are triaged by dev team and are in investigation. Area\Tests Issues that are targeted to tests or test projects labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area\Tests Issues that are targeted to tests or test projects ✔️ Triage Done Issues that are triaged by dev team and are in investigation.
Projects
None yet
Development

No branches or pull requests

2 participants