From e0367ad35acc72a1b5f0f9a849b50ee3e4fc6201 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Wed, 27 Mar 2024 12:45:15 -0700 Subject: [PATCH] Add build step to check for `inet_error` Related to: * #1524 * https://github.com/rabbitmq/rabbitmq-dotnet-client/commit/1fa0562081d65f923f01458216bab96488ab22f0 --- .ci/ubuntu/gha-log-check.sh | 16 ++++++++++++++++ .ci/windows/gha-log-check.ps1 | 13 +++++++++++++ .github/workflows/build-test.yaml | 8 ++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 .ci/ubuntu/gha-log-check.sh create mode 100644 .ci/windows/gha-log-check.ps1 diff --git a/.ci/ubuntu/gha-log-check.sh b/.ci/ubuntu/gha-log-check.sh new file mode 100755 index 000000000..8301df1f3 --- /dev/null +++ b/.ci/ubuntu/gha-log-check.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o xtrace +set -o nounset + +readonly docker_name_prefix='rabbitmq-dotnet-client' + +declare -r rabbitmq_docker_name="$docker_name_prefix-rabbitmq" + +if docker logs "$rabbitmq_docker_name" | grep -iF inet_error +then + echo '[ERROR] found inet_error in RabbitMQ logs' 1>&2 + exit 1 +fi diff --git a/.ci/windows/gha-log-check.ps1 b/.ci/windows/gha-log-check.ps1 new file mode 100644 index 000000000..eb9a8ce52 --- /dev/null +++ b/.ci/windows/gha-log-check.ps1 @@ -0,0 +1,13 @@ +$ProgressPreference = 'Continue' +$VerbosePreference = 'Continue' +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$rabbitmq_log_dir = Join-Path -Path $env:AppData -ChildPath 'RabbitMQ' | Join-Path -ChildPath 'log' +Write-Host "[INFO] looking for errors in '$rabbitmq_log_dir'" + +If (Get-ChildItem $rabbitmq_log_dir\*.log | Select-String -Quiet -SimpleMatch -Pattern inet_error) +{ + Write-Error "[ERROR] found inet_error in '$rabbitmq_log_dir'" + exit 1 +} diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index c4dfb42ab..979c4ef66 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -65,7 +65,7 @@ jobs: path: projects - name: Install and Start RabbitMQ id: install-start-rabbitmq - run: .\.ci\windows\gha-setup.ps1 + run: ${{ github.workspace }}\.ci\windows\gha-setup.ps1 - name: Integration Tests run: | $tx = Start-Job -Verbose -ScriptBlock { & "${{ github.workspace }}\.ci\windows\toxiproxy\toxiproxy-server.exe" }; ` @@ -79,6 +79,8 @@ jobs: --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' + - name: Check for errors in RabbitMQ logs + run: ${{ github.workspace }}\.ci\windows\gha-log-check.ps1 - name: Maybe upload RabbitMQ logs if: failure() uses: actions/upload-artifact@v4 @@ -110,7 +112,7 @@ jobs: path: projects - name: Install and Start RabbitMQ id: install-start-rabbitmq - run: .\.ci\windows\gha-setup.ps1 + run: ${{ github.workspace }}\.ci\windows\gha-setup.ps1 - name: Sequential Integration Tests run: dotnet test --environment "RABBITMQ_RABBITMQCTL_PATH=${{ steps.install-start-rabbitmq.outputs.path }}" "${{ github.workspace }}\projects\Test\SequentialIntegration\SequentialIntegration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' - name: Maybe upload RabbitMQ logs @@ -186,6 +188,8 @@ jobs: --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' + - name: Check for errors in RabbitMQ logs + run: ${{ github.workspace}}/.ci/ubuntu/gha-log-check.sh - name: Maybe upload RabbitMQ logs if: failure() uses: actions/upload-artifact@v4