Skip to content

Commit

Permalink
* Make sure toxic names are unique.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Dec 9, 2024
1 parent cf84790 commit 4cd27de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 13 additions & 5 deletions projects/Test/Integration/TestToxiproxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ public async Task TestThatStoppedSocketResultsInHeartbeatTimeout()

Assert.True(await tcs.Task);

var timeoutToxic = new TimeoutToxic();
string toxicName = $"rmq-localhost-timeout-{Util.Now}-{GenerateShortUuid()}";
var timeoutToxic = new TimeoutToxic
{
Name = toxicName
};
timeoutToxic.Attributes.Timeout = 0;
timeoutToxic.Toxicity = 1.0;

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

string toxicName = $"rmq-localhost-reset_peer-{Util.Now}-{GenerateShortUuid()}";
var resetPeerToxic = new ResetPeerToxic();
resetPeerToxic.Name = toxicName;
var resetPeerToxic = new ResetPeerToxic
{
Name = toxicName
};
resetPeerToxic.Attributes.Timeout = 500;
resetPeerToxic.Toxicity = 1.0;

Expand Down Expand Up @@ -355,8 +361,10 @@ public async Task TestPublisherConfirmationThrottling()
await channelCreatedTcs.Task;

string toxicName = $"rmq-localhost-bandwidth-{Util.Now}-{GenerateShortUuid()}";
var bandwidthToxic = new BandwidthToxic();
bandwidthToxic.Name = toxicName;
var bandwidthToxic = new BandwidthToxic
{
Name = toxicName
};
bandwidthToxic.Attributes.Rate = 0;
bandwidthToxic.Toxicity = 1.0;
bandwidthToxic.Stream = ToxicDirection.DownStream;
Expand Down
5 changes: 3 additions & 2 deletions projects/Test/Integration/ToxiproxyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Test;
using Toxiproxy.Net;
using Toxiproxy.Net.Toxics;

namespace Integration
{
public class ToxiproxyManager : IDisposable
{
private const string ProxyNamePrefix = "rmq-";
private const string ProxyNamePrefix = "rmq";
private const ushort ProxyPortStart = 55669;
private static int s_proxyPort = ProxyPortStart;

Expand Down Expand Up @@ -68,7 +69,7 @@ public ToxiproxyManager(string testDisplayName, bool isRunningInCI, bool isWindo

public async Task InitializeAsync()
{
_proxy.Name = $"{ProxyNamePrefix}{_testDisplayName}";
_proxy.Name = $"{ProxyNamePrefix}-{_testDisplayName}-{Util.Now}";

try
{
Expand Down

0 comments on commit 4cd27de

Please sign in to comment.