Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement asynchronous methods. #1347

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .ci/oauth2/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function start_rabbitmq
--network "$docker_network" \
--publish 5672:5672 \
--publish 15672:15672 \
--volume "$GITHUB_WORKSPACE/projects/OAuth2Test/enabled_plugins:/etc/rabbitmq/enabled_plugins" \
--volume "$GITHUB_WORKSPACE/projects/OAuth2Test/$mode/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro" \
--volume "$GITHUB_WORKSPACE/projects/OAuth2Test/$mode/signing-key/signing-key.pem:/etc/rabbitmq/signing-key.pem:ro" \
--volume "$GITHUB_WORKSPACE/projects/Test/OAuth2/enabled_plugins:/etc/rabbitmq/enabled_plugins" \
--volume "$GITHUB_WORKSPACE/projects/Test/OAuth2/$mode/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro" \
--volume "$GITHUB_WORKSPACE/projects/Test/OAuth2/$mode/signing-key/signing-key.pem:/etc/rabbitmq/signing-key.pem:ro" \
rabbitmq:3-management
}

Expand Down Expand Up @@ -90,7 +90,7 @@ function start_oauth_service
--publish 8080:8080 \
--env 'UAA_CONFIG_PATH=/uaa' \
--env 'JAVA_OPTS=-Djava.security.egd=file:/dev/./urandom' \
--volume "$GITHUB_WORKSPACE/projects/OAuth2Test/uaa:/uaa" \
--volume "$GITHUB_WORKSPACE/projects/Test/OAuth2/uaa:/uaa" \
"cloudfoundry/uaa:$uaa_image_version"
else
readonly keycloak_docker_name="$docker_name_prefix-keycloak"
Expand All @@ -101,7 +101,7 @@ function start_oauth_service
--env 'KEYCLOAK_ADMIN=admin' \
--env 'KEYCLOAK_ADMIN_PASSWORD=admin' \
--env KC_HEALTH_ENABLED=true \
--volume "$GITHUB_WORKSPACE/projects/OAuth2Test/keycloak/import:/opt/keycloak/data/import" \
--volume "$GITHUB_WORKSPACE/projects/Test/OAuth2/keycloak/import:/opt/keycloak/data/import" \
"quay.io/keycloak/keycloak:$keycloak_image_version" start-dev --metrics-enabled=true --import-realm
fi
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/oauth2/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ source "$script_dir/common.sh"

export OAUTH2_MODE="$mode"

dotnet test --environment OAUTH2_MODE="$mode" "$GITHUB_WORKSPACE/projects/OAuth2Test/OAuth2Test.csproj" --logger "console;verbosity=detailed" --framework "net6.0"
dotnet test --environment OAUTH2_MODE="$mode" "$GITHUB_WORKSPACE/projects/Test/OAuth2/OAuth2.csproj" --logger "console;verbosity=detailed"
5 changes: 4 additions & 1 deletion .ci/ubuntu/rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
log.console = false
log.exchange = false
log.file = /var/log/rabbitmq/rabbitmq.log
log.file.level = debug
log.file.level = info
# log.connection.level = warning
# log.channel.level = warning
listeners.tcp.default = 5672
listeners.ssl.default = 5671
reverse_dns_lookups = false
Expand Down
39 changes: 0 additions & 39 deletions .ci/windows/gha-run-tests.ps1

This file was deleted.

14 changes: 13 additions & 1 deletion .ci/windows/gha-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ $erlang_home = (Get-ItemProperty -LiteralPath $erlang_reg_path\$erlang_erts_vers
Write-Host "[INFO] Setting ERLANG_HOME to '$erlang_home'..."
$env:ERLANG_HOME = $erlang_home
[Environment]::SetEnvironmentVariable('ERLANG_HOME', $erlang_home, 'Machine')
Add-Content -Verbose -LiteralPath $env:GITHUB_ENV -Value "ERLANG_HOME=$erlang_home"

Write-Host "[INFO] Setting RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS..."
$env:RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS = '-rabbitmq_stream advertised_host localhost'
Expand Down Expand Up @@ -189,6 +190,17 @@ Write-Host '[INFO] Enabling plugins...'
& $rabbitmq_plugins_path enable rabbitmq_management rabbitmq_stream rabbitmq_stream_management rabbitmq_amqp1_0

echo Q | openssl s_client -connect localhost:5671 -CAfile "$certs_dir/ca_certificate.pem" -cert "$certs_dir/client_localhost_certificate.pem" -key "$certs_dir/client_localhost_key.pem" -pass pass:grapefruit
if ($LASTEXITCODE -ne 0) {
if ($LASTEXITCODE -ne 0)
{
throw "[ERROR] 'openssl s_client' returned error: $LASTEXITCODE"
}


$rabbitmqctl_path = Resolve-Path -LiteralPath `
(Join-Path -Path $rabbitmq_base_path -ChildPath "rabbitmq_server-$rabbitmq_version" | Join-Path -ChildPath 'sbin' | Join-Path -ChildPath 'rabbitmqctl.bat')

Write-Host "[INFO] Setting RABBITMQ_RABBITMQCTL_PATH to '$rabbitmqctl_path'..."
$env:RABBITMQ_RABBITMQCTL_PATH = $rabbitmqctl_path
[Environment]::SetEnvironmentVariable('RABBITMQ_RABBITMQCTL_PATH', $rabbitmqctl_path, 'Machine')
Add-Content -Verbose -LiteralPath $env:GITHUB_OUTPUT -Value "path=$rabbitmqctl_path"
Add-Content -Verbose -LiteralPath $env:GITHUB_ENV -Value "RABBITMQ_RABBITMQCTL_PATH=$rabbitmqctl_path"
5 changes: 4 additions & 1 deletion .ci/windows/rabbitmq.conf.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
log.console = false
log.file.level = debug
log.exchange = false
log.file.level = info
# log.connection.level = warning
# log.channel.level = warning
listeners.tcp.default = 5672
listeners.ssl.default = 5671
reverse_dns_lookups = false
Expand Down
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/rabbitmq/rabbitmq-dotnet-client/commit/1713f50eb2dc52a97184f3857f70841dd55b5bef
1713f50eb2dc52a97184f3857f70841dd55b5bef
67c02d79d3ae48fea7de93c758dce91a51d14988
# Revert the above
6b1a06bd429f395891a3230cad92e674dcbbb0d2
191 changes: 163 additions & 28 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
build-win32:
name: build/test on windows-latest
name: build, unit test on windows-latest
runs-on: windows-latest
# https://github.com/NuGet/Home/issues/11548
env:
Expand All @@ -15,13 +15,6 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
- name: Cache installers
uses: actions/cache@v3
with:
# Note: the cache path is relative to the workspace directory
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
path: ~/installers
key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
- name: Cache NuGet packages
uses: actions/cache@v3
with:
Expand All @@ -31,24 +24,99 @@ jobs:
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-v1-nuget-
- name: Install and Start RabbitMQ
run: .\.ci\windows\gha-setup.ps1
- name: List NuGet sources
run: dotnet nuget locals all --list
- name: Build (Debug)
run: dotnet build ${{ github.workspace }}\Build.csproj
- name: Verify
run: dotnet format ${{ github.workspace }}\RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
- name: Test
run: .\.ci\windows\gha-run-tests.ps1
run: dotnet format ${{ github.workspace }}\RabbitMQDotNetClient.sln --no-restore --verify-no-changes --verbosity=diagnostic
- name: APIApproval Test
run: dotnet test "${{ github.workspace }}\projects\Test\Unit\Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' --filter='FullyQualifiedName=Test.Unit.APIApproval.Approve'
- name: Unit Tests
run: dotnet test "${{ github.workspace }}\projects\Test\Unit\Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
- name: Upload Build (Debug)
uses: actions/upload-artifact@v3
with:
name: rabbitmq-dotnet-client-build-win32
path: |
projects/Test/Unit/bin
projects/Test/AsyncIntegration/bin
projects/Test/Integration/bin
projects/Test/SequentialIntegration/bin
projects/RabbitMQ.*/bin
integration-win32:
name: integration test on windows-latest
needs: build-win32
runs-on: windows-latest
# https://github.com/NuGet/Home/issues/11548
env:
NUGET_CERT_REVOCATION_MODE: offline
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Cache installers
uses: actions/cache@v3
with:
# Note: the cache path is relative to the workspace directory
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
path: ~/installers
key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
- name: Download Build (Debug)
uses: actions/download-artifact@v3
with:
name: rabbitmq-dotnet-client-build-win32
path: projects
- name: Install and Start RabbitMQ
id: install-start-rabbitmq
run: .\.ci\windows\gha-setup.ps1
- name: Async Integration Tests
run: dotnet test --environment "RABBITMQ_RABBITMQCTL_PATH=${{ steps.install-start-rabbitmq.outputs.path }}" --environment 'RABBITMQ_LONG_RUNNING_TESTS=false' "${{ github.workspace }}\projects\Test\AsyncIntegration\AsyncIntegration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
- name: Integration Tests
run: dotnet test --environment "RABBITMQ_RABBITMQCTL_PATH=${{ steps.install-start-rabbitmq.outputs.path }}" --environment 'RABBITMQ_LONG_RUNNING_TESTS=false' --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: Maybe upload RabbitMQ logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: rabbitmq-logs
name: rabbitmq-logs-integration-win32
path: ~/AppData/Roaming/RabbitMQ/log/
build:
name: build/test on ubuntu-latest
sequential-integration-win32:
name: sequential integration test on windows-latest
needs: build-win32
runs-on: windows-latest
# https://github.com/NuGet/Home/issues/11548
env:
NUGET_CERT_REVOCATION_MODE: offline
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Cache installers
uses: actions/cache@v3
with:
# Note: the cache path is relative to the workspace directory
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#using-the-cache-action
path: ~/installers
key: ${{ runner.os }}-v0-${{ hashFiles('.ci/versions.json') }}
- name: Download Build (Debug)
uses: actions/download-artifact@v3
with:
name: rabbitmq-dotnet-client-build-win32
path: projects
- name: Install and Start RabbitMQ
id: install-start-rabbitmq
run: .\.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
if: failure()
uses: actions/upload-artifact@v3
with:
name: rabbitmq-logs-sequential-integration-win32
path: ~/AppData/Roaming/RabbitMQ/log/

build-ubuntu:
name: build, unit test on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Clone repository
Expand All @@ -68,26 +136,93 @@ jobs:
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-v1-nuget-
- name: Start RabbitMQ
id: start-rabbitmq
run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
- name: List NuGet sources
run: dotnet nuget locals all --list
- name: Build (Debug)
run: dotnet build ${{ github.workspace }}/Build.csproj
- name: Verify
run: dotnet format ${{ github.workspace }}/RabbitMQDotNetClient.sln --verify-no-changes --verbosity=diagnostic
- name: Test
run: dotnet format ${{ github.workspace }}/RabbitMQDotNetClient.sln --no-restore --verify-no-changes --verbosity=diagnostic
- name: APIApproval Test
run: dotnet test "${{ github.workspace }}/projects/Test/Unit/Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' --filter='FullyQualifiedName=Test.Unit.APIApproval.Approve'
- name: Unit Tests
run: dotnet test "${{ github.workspace }}/projects/Test/Unit/Unit.csproj" --no-restore --no-build --verbosity=diagnostic --logger 'console;verbosity=detailed'
- name: Upload Build (Debug)
uses: actions/upload-artifact@v3
with:
name: rabbitmq-dotnet-client-build-ubuntu
path: |
projects/Test/Unit/bin
projects/Test/AsyncIntegration/bin
projects/Test/Integration/bin
projects/Test/SequentialIntegration/bin
projects/RabbitMQ.*/bin
integration-ubuntu:
name: integration test on ubuntu-latest
needs: build-ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x
- name: Download Build (Debug)
uses: actions/download-artifact@v3
with:
name: rabbitmq-dotnet-client-build-ubuntu
path: projects
- name: Start RabbitMQ
id: start-rabbitmq
run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
- name: Async Integration Tests
run: |
dotnet test \
--environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:${{ steps.start-rabbitmq.outputs.id }}" \
--environment 'RABBITMQ_LONG_RUNNING_TESTS=true' \
"${{ github.workspace }}/projects/Test/AsyncIntegration/AsyncIntegration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
- name: Integration Tests
run: |
dotnet test \
--environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:${{ steps.start-rabbitmq.outputs.id }}" \
--environment 'RABBITMQ_LONG_RUNNING_TESTS=false' \
--environment 'PASSWORD=grapefruit' \
--environment SSL_CERTS_DIR="${{ github.workspace }}/.ci/certs" \
"${{ github.workspace }}/projects/Unit/Unit.csproj" --no-restore --no-build --logger 'console;verbosity=detailed' --framework 'net6.0'
"${{ github.workspace }}/projects/Test/Integration/Integration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
- name: Maybe upload RabbitMQ logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: rabbitmq-logs-integration-ubuntu
path: ${{ github.workspace }}/.ci/ubuntu/log/
sequential-integration-ubuntu:
name: sequential integration test on ubuntu-latest
needs: build-ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x
- name: Download Build (Debug)
uses: actions/download-artifact@v3
with:
name: rabbitmq-dotnet-client-build-ubuntu
path: projects
- name: Start RabbitMQ
id: start-rabbitmq
run: ${{ github.workspace }}/.ci/ubuntu/gha-setup.sh
- name: Sequential Integration Tests
run: |
dotnet test \
--environment "RABBITMQ_RABBITMQCTL_PATH=DOCKER:${{ steps.start-rabbitmq.outputs.id }}" \
"${{ github.workspace }}/projects/Test/SequentialIntegration/SequentialIntegration.csproj" --no-restore --no-build --logger 'console;verbosity=detailed'
- name: Maybe upload RabbitMQ logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: rabbitmq-logs
name: rabbitmq-logs-sequential-integration-ubuntu
path: ${{ github.workspace }}/.ci/ubuntu/log/
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ build/

BenchmarkDotNet.Artifacts/*

projects/Unit/APIApproval.Approve.received.txt
projects/Unit/APIApproval.Approve.*.received.txt
projects/Test/Unit/APIApproval.Approve.received.txt
projects/Test/Unit/APIApproval.Approve.*.received.txt

# Visual Studio 2015 cache/options directory
.vs/
Expand Down Expand Up @@ -115,7 +115,7 @@ UpgradeLog*.htm

# Unit tests

projects/Unit*/TestResult.xml
projects/Test/Unit*/TestResult.xml

# Development scripts

Expand Down
Loading