Make some tests to run in serial mode.
MODIFY
WalletWasabi.Tests/UnitTests/BitcoinCore/NodeBuildingTests.cs
WalletWasabi.Tests/UnitTests/BitcoinCore/NodeBuildingTests.cs
@@ -84,20 +84,5 @@ namespace WalletWasabi.Tests.UnitTests.BitcoinCore
await coreNode.TryStopAsync();
}
}
-
- /// <summary>
- /// Tests that Bitcoin Node reports correct <see cref="Constants.BitcoinCoreVersion" /> version.
- /// </summary>
- /// <remarks>
- /// A few seconds may be enough for this test to run on a personal computer. However,
- /// CI using parallelization and all available threads has hard time to finish it in a few seconds.
- /// </remarks>
- [Fact]
- public async Task GetVersionTestsAsync()
- {
- using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
- Version version = await CoreNode.GetVersionAsync(cts.Token);
- Assert.Equal(Constants.BitcoinCoreVersion, version);
- }
}
}

ADD
WalletWasabi.Tests/UnitTests/BitcoinCore/SerialNodeBuildingTests.cs
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using WalletWasabi.BitcoinCore;
+using Xunit;
+
+namespace WalletWasabi.Tests.UnitTests.BitcoinCore
+{
+ /// <summary>
+ /// The test in this collection is time-sensitive, therefore this test collection is run in a special way:
+ /// Parallel-capable test collections will be run first (in parallel), followed by this parallel-disabled test collections (run sequentially).
+ /// </summary>
+ /// <seealso href="https://xunit.net/docs/running-tests-in-parallel.html#parallelism-in-test-frameworks"/>
+ [Collection("Serial unit tests collection")]
+ public class SerialNodeBuildingTests
+ {
+ [Fact]
+ public async Task GetNodeVersionTestsAsync()
+ {
+ using var cts = new CancellationTokenSource(7000);
+ Version version = await CoreNode.GetVersionAsync(cts.Token);
+ Assert.Equal(WalletWasabi.Helpers.Constants.BitcoinCoreVersion, version);
+ }
+ }
+}

MODIFY
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
@@ -2,11 +2,9 @@ using NBitcoin;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Hwi;
-using WalletWasabi.Hwi.Exceptions;
using WalletWasabi.Hwi.Models;
using WalletWasabi.Hwi.Parsers;
using WalletWasabi.Hwi.ProcessBridge;
@@ -117,21 +115,6 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
await Task.WhenAny(tasks);
}
- [Fact]
- public async Task HwiProcessBridgeTestAsync()
- {
- HwiProcessBridge pb = new HwiProcessBridge();
-
- using var cts = new CancellationTokenSource(ReasonableRequestTimeout);
- var res = await pb.SendCommandAsync("version", false, cts.Token);
- Assert.NotEmpty(res.response);
-
- bool stdInputActionCalled = false;
- res = await pb.SendCommandAsync("version", false, cts.Token, (sw) => stdInputActionCalled = true);
- Assert.NotEmpty(res.response);
- Assert.True(stdInputActionCalled);
- }
-
[Fact]
public async Task OpenConsoleDoesntThrowAsync()
{

ADD
WalletWasabi.Tests/UnitTests/Hwi/SerialDefaultResponseTests.cs
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using WalletWasabi.Hwi.ProcessBridge;
+using Xunit;
+
+namespace WalletWasabi.Tests.UnitTests.Hwi
+{
+ /// <summary>
+ /// The test in this collection is time-sensitive, therefore this test collection is run in a special way:
+ /// Parallel-capable test collections will be run first (in parallel), followed by this parallel-disabled test collections (run sequentially).
+ /// </summary>
+ /// <seealso href="https://xunit.net/docs/running-tests-in-parallel.html#parallelism-in-test-frameworks"/>
+ [Collection("Serial unit tests collection")]
+ public class SerialDefaultResponseTests
+ {
+ public TimeSpan ReasonableRequestTimeout { get; } = TimeSpan.FromMinutes(1);
+
+ [Fact]
+ public async Task HwiProcessBridgeTestAsync()
+ {
+ HwiProcessBridge pb = new HwiProcessBridge();
+
+ using var cts = new CancellationTokenSource(ReasonableRequestTimeout);
+ var res = await pb.SendCommandAsync("version", false, cts.Token);
+ Assert.NotEmpty(res.response);
+
+ bool stdInputActionCalled = false;
+ res = await pb.SendCommandAsync("version", false, cts.Token, (sw) => stdInputActionCalled = true);
+ Assert.NotEmpty(res.response);
+ Assert.True(stdInputActionCalled);
+ }
+ }
+}

ADD
WalletWasabi.Tests/XunitConfiguration/SerialCollectionDefinition.cs
+using Xunit;
+
+namespace WalletWasabi.Tests.XunitConfiguration
+{
+ /// <summary>
+ /// This class has no code, and is never created. Its purpose is simply
+ // to be the place to apply [CollectionDefinition].
+ /// </summary>
+ /// <seealso href="https://xunit.net/docs/shared-context#collection-fixture"/>
+ [CollectionDefinition("Serial unit tests collection", DisableParallelization = true)]
+ public class SerialCollectionDefinition
+ {
+ }
+}

Make some tests to run in serial mode.