Skip to content

Commit add20d2

Browse files
committed
* Re-try running tests in parallel by TFM, by generating a short UUID for entity names.
1 parent 15b4f21 commit add20d2

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Directory.Build.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2323
<RepositoryType>git</RepositoryType>
2424
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-amqp-dotnet-client</RepositoryUrl>
25-
<TestTfmsInParallel>false</TestTfmsInParallel>
25+
<!--
26+
NOTE: un-comment this if it appears that connections or other entities that should be unique
27+
are created at the same time. .NET 9 runs parallel test suites per-TFM
28+
https://github.com/dotnet/sdk/issues/39470
29+
<TestTfmsInParallel>false</TestTfmsInParallel>
30+
-->
2631
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2732
<LangVersion>default</LangVersion>
2833
</PropertyGroup>

Tests/IntegrationTest.Static.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,6 @@ private static bool InitIsVerbose()
323323

324324
return false;
325325
}
326+
327+
private static string GenerateShortUuid() => S_Random.Next().ToString("x");
326328
}

Tests/IntegrationTest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public abstract partial class IntegrationTest : IAsyncLifetime
3333
protected IManagement? _management;
3434
protected string _queueName;
3535
protected string _exchangeName;
36-
protected string _containerId = $"integration-test-{Now}";
36+
protected string _containerId = $"integration-test-{Now}-{GenerateShortUuid()}";
3737

3838
private readonly bool _setupConnectionAndManagement;
3939
protected readonly ConnectionSettingsBuilder _connectionSettingBuilder;
@@ -48,9 +48,9 @@ public IntegrationTest(ITestOutputHelper testOutputHelper,
4848

4949
_testDisplayName = InitTestDisplayName();
5050

51-
_queueName = $"{_testDisplayName}-queue-{Now}";
52-
_exchangeName = $"{_testDisplayName}-exchange-{Now}";
53-
_containerId = $"{_testDisplayName}:{Now}";
51+
_queueName = $"{_testDisplayName}-queue-{Now}-{GenerateShortUuid()}";
52+
_exchangeName = $"{_testDisplayName}-exchange-{Now}-{GenerateShortUuid()}";
53+
_containerId = $"{_testDisplayName}:{Now}-{GenerateShortUuid()}";
5454

5555
if (IsVerbose)
5656
{
@@ -358,7 +358,9 @@ private string InitTestDisplayName()
358358
object? testObj = testMember.GetValue(_testOutputHelper);
359359
if (testObj is ITest test)
360360
{
361-
rv = test.DisplayName;
361+
rv = test.DisplayName
362+
.Replace("Test.", string.Empty)
363+
.Replace("Integration.", "I.");
362364
}
363365
}
364366

0 commit comments

Comments
 (0)