From 6e3ea74d5df9274ab2f8c6da7cc23f0ef89a0000 Mon Sep 17 00:00:00 2001 From: Karmel Indych Date: Tue, 7 May 2024 17:58:39 +0300 Subject: [PATCH] RavenDB-22225 avoid opening write tx in the same test thread --- test/RachisTests/BasicTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/RachisTests/BasicTests.cs b/test/RachisTests/BasicTests.cs index 75e800f84805..f4aaee35d0d2 100644 --- a/test/RachisTests/BasicTests.cs +++ b/test/RachisTests/BasicTests.cs @@ -6,6 +6,7 @@ using Raven.Server.ServerWide.Context; using Sparrow.Json; using Sparrow.Server; +using Sparrow.Utils; using Tests.Infrastructure; using Xunit; using Xunit.Abstractions; @@ -63,9 +64,13 @@ public async Task RavenDB_13659() var leader = await CreateNetworkAndGetLeader(1); var mre = new AsyncManualResetEvent(); var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var currentThread = NativeMemory.CurrentThreadStats.ManagedThreadId; leader.Timeout.Start(() => { + if (currentThread == NativeMemory.CurrentThreadStats.ManagedThreadId) + throw new InvalidOperationException("Can't use same thread as the xUnit test"); + mre.Set(); try {