Skip to content

Commit

Permalink
Use unique queue names.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Dec 9, 2024
1 parent 6354045 commit 5c0a3d3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
15 changes: 8 additions & 7 deletions projects/Test/Common/IntegrationFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ protected async Task WithTemporaryChannelAsync(Func<IChannel, Task> action)

protected string GenerateExchangeName()
{
return $"{_testDisplayName}-exchange-{Util.Now}-{Util.GenerateShortUuid()}";
return $"{_testDisplayName}-exchange-{Now}-{GenerateShortUuid()}";
}

protected string GenerateQueueName()
{
return $"{_testDisplayName}-queue-{Util.Now}-{Util.GenerateShortUuid()}";
return $"{_testDisplayName}-queue-{Now}-{GenerateShortUuid()}";
}

protected Task WithTemporaryNonExclusiveQueueAsync(Func<IChannel, string, Task> action)
Expand Down Expand Up @@ -533,7 +533,7 @@ protected ConnectionFactory CreateConnectionFactory(
{
return new ConnectionFactory
{
ClientProvidedName = $"{_testDisplayName}:{Util.Now}:{GetConnectionIdx()}",
ClientProvidedName = $"{_testDisplayName}:{Now}:{GetConnectionIdx()}",
ContinuationTimeout = WaitSpan,
HandshakeContinuationTimeout = WaitSpan,
ConsumerDispatchConcurrency = consumerDispatchConcurrency
Expand Down Expand Up @@ -628,10 +628,11 @@ protected static byte[] GetRandomBody(ushort size = 1024)
return body;
}

protected static int RandomNext(int min, int max)
{
return Util.S_Random.Next(min, max);
}
protected static string Now => Util.Now;

protected static string GenerateShortUuid() => Util.GenerateShortUuid();

protected static int RandomNext(int min, int max) => Util.S_Random.Next(min, max);

protected static Task WaitForRecoveryAsync(IConnection conn)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public async Task TestConsumerWorkServiceRecovery()
await using AutorecoveringConnection c = await CreateAutorecoveringConnectionAsync();
await using (IChannel ch = await c.CreateChannelAsync())
{
string q = (await ch.QueueDeclareAsync("dotnet-client.recovery.consumer_work_pool1",
string q = (await ch.QueueDeclareAsync(GenerateQueueName(),
false, false, false)).QueueName;
var cons = new AsyncEventingBasicConsumer(ch);
await ch.BasicConsumeAsync(q, true, cons);
Expand Down Expand Up @@ -143,7 +143,7 @@ public async Task TestConsumerWorkServiceRecovery()
[Fact]
public async Task TestConsumerRecoveryOnClientNamedQueueWithOneRecovery()
{
const string q0 = "dotnet-client.recovery.queue1";
string q0 = GenerateQueueName();
// connection #1
await using AutorecoveringConnection c = await CreateAutorecoveringConnectionAsync();
await using (IChannel ch = await c.CreateChannelAsync())
Expand Down Expand Up @@ -364,8 +364,7 @@ public async Task TestTopologyRecoveryConsumerFilter()
[Fact]
public async Task TestRecoveryWithTopologyDisabled()
{
string queueName = GenerateQueueName() + "-dotnet-client.test.recovery.q2";

string queueName = GenerateQueueName();
await using AutorecoveringConnection conn = await CreateAutorecoveringConnectionWithTopologyRecoveryDisabledAsync();
await using (IChannel ch = await conn.CreateChannelAsync())
{
Expand Down
6 changes: 3 additions & 3 deletions projects/Test/Integration/TestToxiproxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public async Task TestThatStoppedSocketResultsInHeartbeatTimeout()

Assert.True(await tcs.Task);

string toxicName = $"rmq-localhost-timeout-{Util.Now}-{Util.GenerateShortUuid()}";
string toxicName = $"rmq-localhost-timeout-{Now}-{GenerateShortUuid()}";
var timeoutToxic = new TimeoutToxic
{
Name = toxicName
Expand Down Expand Up @@ -275,7 +275,7 @@ public async Task TestTcpReset_GH1464()

Assert.True(await channelCreatedTcs.Task);

string toxicName = $"rmq-localhost-reset_peer-{Util.Now}-{Util.GenerateShortUuid()}";
string toxicName = $"rmq-localhost-reset_peer-{Now}-{GenerateShortUuid()}";
var resetPeerToxic = new ResetPeerToxic
{
Name = toxicName
Expand Down Expand Up @@ -360,7 +360,7 @@ public async Task TestPublisherConfirmationThrottling()

await channelCreatedTcs.Task;

string toxicName = $"rmq-localhost-bandwidth-{Util.Now}-{Util.GenerateShortUuid()}";
string toxicName = $"rmq-localhost-bandwidth-{Now}-{GenerateShortUuid()}";
var bandwidthToxic = new BandwidthToxic
{
Name = toxicName
Expand Down

0 comments on commit 5c0a3d3

Please sign in to comment.