From 4cd27decbb13e36ffc0684cd60b629be81d114c1 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Mon, 9 Dec 2024 10:17:10 -0800 Subject: [PATCH] * Make sure toxic names are unique. --- projects/Test/Integration/TestToxiproxy.cs | 18 +++++++++++++----- projects/Test/Integration/ToxiproxyManager.cs | 5 +++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/Test/Integration/TestToxiproxy.cs b/projects/Test/Integration/TestToxiproxy.cs index bf38997109..25ba534c61 100644 --- a/projects/Test/Integration/TestToxiproxy.cs +++ b/projects/Test/Integration/TestToxiproxy.cs @@ -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; @@ -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; @@ -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; diff --git a/projects/Test/Integration/ToxiproxyManager.cs b/projects/Test/Integration/ToxiproxyManager.cs index cb58ca1749..53fcfb92b7 100644 --- a/projects/Test/Integration/ToxiproxyManager.cs +++ b/projects/Test/Integration/ToxiproxyManager.cs @@ -2,6 +2,7 @@ using System.Net; using System.Threading; using System.Threading.Tasks; +using Test; using Toxiproxy.Net; using Toxiproxy.Net.Toxics; @@ -9,7 +10,7 @@ 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; @@ -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 {