From 0723e450bdb241c0838da189b8c254d36fa992eb Mon Sep 17 00:00:00 2001 From: Sebastiaan Dammann Date: Wed, 15 Nov 2023 16:35:35 +0100 Subject: [PATCH] Fix scope being disposed prematurely Somehow this didn't happen in .NET 7, but obviously the code is wrong here. A classic case of using and then not awaiting the task, leading to a race condition. I suppose this is a follow-up on 6cebeb166a9d0911570a38d84f38b73f949752fd --- .../Pages/JoinRetrospectiveTests.cs | 6 +++--- .../Pages/RetrospectiveLobbyTestsBase.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Return.Web.Tests.Integration/Pages/JoinRetrospectiveTests.cs b/tests/Return.Web.Tests.Integration/Pages/JoinRetrospectiveTests.cs index 16103b8..26c5c8a 100644 --- a/tests/Return.Web.Tests.Integration/Pages/JoinRetrospectiveTests.cs +++ b/tests/Return.Web.Tests.Integration/Pages/JoinRetrospectiveTests.cs @@ -1,6 +1,6 @@ // ****************************************************************************** // © 2019 Sebastiaan Dammann | damsteen.nl -// +// // File: : JoinRetrospectiveTests.cs // Project : Return.Web.Tests.Integration // ****************************************************************************** @@ -181,9 +181,9 @@ public async Task JoinRetrospectivePage_KnownRetrospective_JoinAsFacilitatorUpda Assert.That(() => secondInstance.OnlineList.OnlineListItems.AllInnerTextsAsync().GetAwaiter().GetResult(), Has.One.Contains(myName)); } - private Task SetRetrospective(string retroId, Action action) { + private async Task SetRetrospective(string retroId, Action action) { using IServiceScope scope = this.App.CreateTestServiceScope(); - return scope.SetRetrospective(retroId, action); + await scope.SetRetrospective(retroId, action); } private async Task CreateRetrospective(string facilitatorPassword, string password) { diff --git a/tests/Return.Web.Tests.Integration/Pages/RetrospectiveLobbyTestsBase.cs b/tests/Return.Web.Tests.Integration/Pages/RetrospectiveLobbyTestsBase.cs index 3ad2bc4..478b3a4 100644 --- a/tests/Return.Web.Tests.Integration/Pages/RetrospectiveLobbyTestsBase.cs +++ b/tests/Return.Web.Tests.Integration/Pages/RetrospectiveLobbyTestsBase.cs @@ -1,6 +1,6 @@ // ****************************************************************************** // © Sebastiaan Dammann | damsteen.nl -// +// // File: : RetrospectiveLobbyTestsBase.cs // Project : Return.Web.Tests.Integration // ****************************************************************************** @@ -67,9 +67,9 @@ protected async Task Join(RetrospectiveLobby pageObject, bool facilitator, strin protected Task WaitNavigatedToLobby() => Task.WhenAll(WaitNavigatedToLobby(this.Client1), WaitNavigatedToLobby(this.Client2)); - protected Task SetRetrospective(Action action) { + protected async Task SetRetrospective(Action action) { using IServiceScope scope = this.App.CreateTestServiceScope(); - return scope.SetRetrospective(this.RetroId, action); + await scope.SetRetrospective(this.RetroId, action); } private static async Task WaitNavigatedToLobby(RetrospectiveLobby pageObject) {