Skip to content

Fix flaky tests #3

@gered

Description

@gered

Tracking any flaky tests that we notice in the CI in this issue.


Flaky Test 1

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:08.92]     EndPointCommerce.Tests.AdminPortal.Services.UserSearcherTests.Search_CanSearch(searchValue: "test_04@email.com", matchedItemId: 40) [FAIL]
  Failed EndPointCommerce.Tests.AdminPortal.Services.UserSearcherTests.Search_CanSearch(searchValue: "test_04@email.com", matchedItemId: 40) [1 s]
  Error Message:
   System.InvalidOperationException : An exception has been raised that is likely due to a transient failure.
---- Microsoft.EntityFrameworkCore.DbUpdateException : An error occurred while saving the entity changes. See the inner exception for details.
-------- Npgsql.PostgresException : 40P01: deadlock detected

DETAIL: Process 113 waits for ShareLock on transaction 1090; blocked by process 110.
Process 110 waits for ShareLock on transaction 1093; blocked by process 113.
  Stack Trace:
     at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at EndPointCommerce.Tests.AdminPortal.Services.UserSearcherTests.PopulateRecords() in /home/runner/work/end-point-commerce/end-point-commerce/EndPointCommerce.Tests/AdminPortal/Services/UserSearcherTests.cs:line 32
   at EndPointCommerce.Tests.AdminPortal.Services.BaseEntitySearcherTests`2.RunSearchingTheory(String searchValue, Action`1 asserter) in /home/runner/work/end-point-commerce/end-point-commerce/EndPointCommerce.Tests/AdminPortal/Services/BaseEntitySearcherTests.cs:line 79
   at EndPointCommerce.Tests.AdminPortal.Services.UserSearcherTests.Search_CanSearch(String searchValue, Int32 matchedItemId) in /home/runner/work/end-point-commerce/end-point-commerce/EndPointCommerce.Tests/AdminPortal/Services/UserSearcherTests.cs:line 41
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__112_0(DbContext _, ValueTuple`2 t)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
----- Inner Stack Trace -----
   at Npgsql.Internal.NpgsqlConnector.ReadMessageLong(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)

Flaky Test 2

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:09.67]     EndPointCommerce.Tests.AdminPortal.Services.OrderSearcherTests.Search_CanSearch(searchValue: "500", matchedItemId: 10005) [FAIL]
  Failed EndPointCommerce.Tests.AdminPortal.Services.OrderSearcherTests.Search_CanSearch(searchValue: "500", matchedItemId: 10005) [64 ms]
  Error Message:
   Assert.Equal() Failure: Values differ
Expected: 1
Actual:   2
  Stack Trace:
     at EndPointCommerce.Tests.AdminPortal.Services.BaseEntitySearcherTests`2.RunSearchingTheory(String searchValue, Action`1 asserter) in /home/runner/work/end-point-commerce/end-point-commerce/EndPointCommerce.Tests/AdminPortal/Services/BaseEntitySearcherTests.cs:line 99
   at EndPointCommerce.Tests.AdminPortal.Services.OrderSearcherTests.Search_CanSearch(String searchValue, Int32 matchedItemId) in /home/runner/work/end-point-commerce/end-point-commerce/EndPointCommerce.Tests/AdminPortal/Services/OrderSearcherTests.cs:line 142
--- End of stack trace from previous location ---

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions