Skip to content

Commit 0c2ee5b

Browse files
committed
Toxiproxy manager change
* Use `Guid.NewGuid` to ensure unique name * No need to delete first as names should be unique
1 parent 103c39e commit 0c2ee5b

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

.github/workflows/build-test.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,17 @@ jobs:
6969
- name: Integration Tests
7070
timeout-minutes: 25
7171
run: |
72-
Start-Job -Verbose -ScriptBlock { & "${{ github.workspace }}\.ci\windows\toxiproxy\toxiproxy-server.exe" }; `
72+
Start-Job -Verbose -ScriptBlock { & "${{ github.workspace }}\.ci\windows\toxiproxy\toxiproxy-server.exe" | Out-File -LiteralPath $env:APPDATA\RabbitMQ\log\toxiproxy-log.txt }; `
7373
dotnet test `
7474
--environment 'RABBITMQ_LONG_RUNNING_TESTS=true' `
7575
--environment "RABBITMQ_RABBITMQCTL_PATH=${{ steps.install-start-rabbitmq.outputs.path }}" `
7676
--environment 'RABBITMQ_TOXIPROXY_TESTS=true' `
7777
--environment 'PASSWORD=grapefruit' `
7878
--environment SSL_CERTS_DIR="${{ github.workspace }}\.ci\certs" `
79-
"${{ github.workspace }}\projects\Test\Integration\Integration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
79+
"${{ github.workspace }}\projects\Test\Integration\Integration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'; `
80+
Get-Job | Stop-Job -Verbose -PassThru | Remove-Job -Verbose
8081
- name: Check for errors in RabbitMQ logs
8182
run: ${{ github.workspace }}\.ci\windows\gha-log-check.ps1
82-
- name: Maybe collect Toxiproxy logs
83-
if: failure()
84-
run: Get-Job | Where-Object { $_.HasMoreData } | Receive-Job | Out-File -Append -LiteralPath $env:APPDATA\RabbitMQ\log\toxiproxy-log.txt
8583
- name: Maybe upload RabbitMQ and Toxiproxy logs
8684
if: failure()
8785
uses: actions/upload-artifact@v4

projects/Test/Integration/ToxiproxyManager.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ public ToxiproxyManager(string testDisplayName, bool isRunningInCI, bool isWindo
3434

3535
_proxyPort = Interlocked.Increment(ref s_proxyPort);
3636

37-
/*
38-
string now = DateTime.UtcNow.ToString("o", System.Globalization.CultureInfo.InvariantCulture);
39-
Console.WriteLine("{0} [DEBUG] {1} _proxyPort {2}", now, testDisplayName, _proxyPort);
40-
*/
41-
4237
_proxyConnection = new Connection(resetAllToxicsAndProxiesOnClose: true);
4338
_proxyClient = _proxyConnection.Client();
4439

@@ -70,17 +65,9 @@ public ToxiproxyManager(string testDisplayName, bool isRunningInCI, bool isWindo
7065

7166
public async Task InitializeAsync()
7267
{
73-
string proxyName = $"{ProxyNamePrefix}-{_testDisplayName}-{Util.Now}-{Util.GenerateShortUuid()}";
68+
string proxyName = $"{ProxyNamePrefix}-{_testDisplayName}-{Util.Now}-{Guid.NewGuid()}";
7469
_proxy.Name = proxyName;
7570

76-
try
77-
{
78-
await _proxyClient.DeleteAsync(_proxy);
79-
}
80-
catch
81-
{
82-
}
83-
8471
ushort retryCount = 5;
8572
do
8673
{

0 commit comments

Comments
 (0)