Skip to content

Commit 4cd27de

Browse files
committed
* Make sure toxic names are unique.
1 parent cf84790 commit 4cd27de

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

projects/Test/Integration/TestToxiproxy.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ public async Task TestThatStoppedSocketResultsInHeartbeatTimeout()
221221

222222
Assert.True(await tcs.Task);
223223

224-
var timeoutToxic = new TimeoutToxic();
224+
string toxicName = $"rmq-localhost-timeout-{Util.Now}-{GenerateShortUuid()}";
225+
var timeoutToxic = new TimeoutToxic
226+
{
227+
Name = toxicName
228+
};
225229
timeoutToxic.Attributes.Timeout = 0;
226230
timeoutToxic.Toxicity = 1.0;
227231

@@ -272,8 +276,10 @@ public async Task TestTcpReset_GH1464()
272276
Assert.True(await channelCreatedTcs.Task);
273277

274278
string toxicName = $"rmq-localhost-reset_peer-{Util.Now}-{GenerateShortUuid()}";
275-
var resetPeerToxic = new ResetPeerToxic();
276-
resetPeerToxic.Name = toxicName;
279+
var resetPeerToxic = new ResetPeerToxic
280+
{
281+
Name = toxicName
282+
};
277283
resetPeerToxic.Attributes.Timeout = 500;
278284
resetPeerToxic.Toxicity = 1.0;
279285

@@ -355,8 +361,10 @@ public async Task TestPublisherConfirmationThrottling()
355361
await channelCreatedTcs.Task;
356362

357363
string toxicName = $"rmq-localhost-bandwidth-{Util.Now}-{GenerateShortUuid()}";
358-
var bandwidthToxic = new BandwidthToxic();
359-
bandwidthToxic.Name = toxicName;
364+
var bandwidthToxic = new BandwidthToxic
365+
{
366+
Name = toxicName
367+
};
360368
bandwidthToxic.Attributes.Rate = 0;
361369
bandwidthToxic.Toxicity = 1.0;
362370
bandwidthToxic.Stream = ToxicDirection.DownStream;

projects/Test/Integration/ToxiproxyManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using System.Net;
33
using System.Threading;
44
using System.Threading.Tasks;
5+
using Test;
56
using Toxiproxy.Net;
67
using Toxiproxy.Net.Toxics;
78

89
namespace Integration
910
{
1011
public class ToxiproxyManager : IDisposable
1112
{
12-
private const string ProxyNamePrefix = "rmq-";
13+
private const string ProxyNamePrefix = "rmq";
1314
private const ushort ProxyPortStart = 55669;
1415
private static int s_proxyPort = ProxyPortStart;
1516

@@ -68,7 +69,7 @@ public ToxiproxyManager(string testDisplayName, bool isRunningInCI, bool isWindo
6869

6970
public async Task InitializeAsync()
7071
{
71-
_proxy.Name = $"{ProxyNamePrefix}{_testDisplayName}";
72+
_proxy.Name = $"{ProxyNamePrefix}-{_testDisplayName}-{Util.Now}";
7273

7374
try
7475
{

0 commit comments

Comments
 (0)