Skip to content

Commit

Permalink
Toxiproxy manager change
Browse files Browse the repository at this point in the history
* Use `Guid.NewGuid` to ensure unique name
* No need to delete first as names should be unique
  • Loading branch information
lukebakken committed Dec 11, 2024
1 parent 103c39e commit 0c2ee5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,17 @@ jobs:
- name: Integration Tests
timeout-minutes: 25
run: |
Start-Job -Verbose -ScriptBlock { & "${{ github.workspace }}\.ci\windows\toxiproxy\toxiproxy-server.exe" }; `
Start-Job -Verbose -ScriptBlock { & "${{ github.workspace }}\.ci\windows\toxiproxy\toxiproxy-server.exe" | Out-File -LiteralPath $env:APPDATA\RabbitMQ\log\toxiproxy-log.txt }; `
dotnet test `
--environment 'RABBITMQ_LONG_RUNNING_TESTS=true' `
--environment "RABBITMQ_RABBITMQCTL_PATH=${{ steps.install-start-rabbitmq.outputs.path }}" `
--environment 'RABBITMQ_TOXIPROXY_TESTS=true' `
--environment 'PASSWORD=grapefruit' `
--environment SSL_CERTS_DIR="${{ github.workspace }}\.ci\certs" `
"${{ github.workspace }}\projects\Test\Integration\Integration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
"${{ github.workspace }}\projects\Test\Integration\Integration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'; `
Get-Job | Stop-Job -Verbose -PassThru | Remove-Job -Verbose
- name: Check for errors in RabbitMQ logs
run: ${{ github.workspace }}\.ci\windows\gha-log-check.ps1
- name: Maybe collect Toxiproxy logs
if: failure()
run: Get-Job | Where-Object { $_.HasMoreData } | Receive-Job | Out-File -Append -LiteralPath $env:APPDATA\RabbitMQ\log\toxiproxy-log.txt
- name: Maybe upload RabbitMQ and Toxiproxy logs
if: failure()
uses: actions/upload-artifact@v4
Expand Down
15 changes: 1 addition & 14 deletions projects/Test/Integration/ToxiproxyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public ToxiproxyManager(string testDisplayName, bool isRunningInCI, bool isWindo

_proxyPort = Interlocked.Increment(ref s_proxyPort);

/*
string now = DateTime.UtcNow.ToString("o", System.Globalization.CultureInfo.InvariantCulture);
Console.WriteLine("{0} [DEBUG] {1} _proxyPort {2}", now, testDisplayName, _proxyPort);
*/

_proxyConnection = new Connection(resetAllToxicsAndProxiesOnClose: true);
_proxyClient = _proxyConnection.Client();

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

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

try
{
await _proxyClient.DeleteAsync(_proxy);
}
catch
{
}

ushort retryCount = 5;
do
{
Expand Down

0 comments on commit 0c2ee5b

Please sign in to comment.