Repository navigation
[C] e2e: mqttv5 custom topics, and a ci-c-e2e-mqttv5 workflow #413
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
Open
Ewerton Scaboro da Silva (ewertons)
wants to merge
5
commits into
main
Choose a base branch
from
c/e2e-mqttv5-custom-topics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+546
−9
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7d029aa
[C] e2e: mqttv5 custom topics, and a ci-c-e2e-mqttv5 workflow
ewertons c8bab76
[C] e2e mqttv5 custom topics: keep callback contexts alive; routing s…
ewertons 393f6ec
[C] e2e mqttv5 custom topics: refusal cases accept only refusal statuses
ewertons ac99dde
[C] e2e mqttv5 custom topics: skip Dependabot runs; full window for n…
ewertons 59f7c35
[C] e2e mqttv5 custom topics: read the routing switch through az_iot_…
ewertons File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # Copyright (c) Microsoft. All rights reserved. | ||
| # Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| # C e2e tests on an mqttv5 IoT Hub. | ||
| # | ||
| # Runs against the shared, long-lived mqttv5 environment (hub, DPS linked through | ||
| # an ADR namespace); nothing is provisioned per run. Each job issues its own | ||
| # device certificate from the DPS X.509 enrollment group's CA | ||
| # (c/eng/e2e-shared-device.ps1 -Prefix E2E_MQTTV5_SHARED) and reads the events | ||
| # endpoint through its own consumer group. Add a job per mqttv5 client. | ||
| # | ||
| # vars: E2E_MQTTV5_SHARED_ID_SCOPE (unset: the workflow skips), | ||
| # E2E_MQTTV5_SHARED_DPS_HOST, plus those of | ||
| # ci-c-e2e-mqttv5-adr-namespace.yml | ||
| # secrets: E2E_MQTTV5_SHARED_GROUP_CA, E2E_MQTTV5_SHARED_IOTHUB_CS, | ||
| # E2E_MQTTV5_SHARED_EVENTHUB_CS, E2E_MQTTV5_SHARED_SAS_GROUP_KEY, | ||
| # AZURE_CLIENT_ID, AZURE_TENANT_ID | ||
| # | ||
| # Pull requests from forks and from Dependabot get no secrets, so they skip. | ||
|
|
||
| name: ci-c-e2e-mqttv5 | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - 'c/src/core/**' | ||
| - 'c/src/mqttv5/**' | ||
| - 'c/inc/azure/iot/*.h' | ||
| - 'c/inc/azure/iot/mqttv5/**' | ||
| - 'c/adapters/paho/**' | ||
| - 'c/tests/e2e/**' | ||
| - 'c/eng/e2e-shared-device.ps1' | ||
| - 'c/eng/e2e-mqttv5-adr-namespace.ps1' | ||
| - '.github/workflows/ci-c-e2e-mqttv5.yml' | ||
| - '.github/workflows/ci-c-e2e-mqttv5-adr-namespace.yml' | ||
| schedule: | ||
| - cron: '30 11 * * *' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # The namespace can drop out of Azure; DPS registrations fail until it is back. | ||
| adr-namespace: | ||
| name: ADR namespace | ||
| if: >- | ||
| ${{ vars.E2E_MQTTV5_SHARED_ID_SCOPE != '' && | ||
| (github.event_name != 'pull_request' || | ||
| (github.event.pull_request.head.repo.full_name == github.repository && | ||
| github.actor != 'dependabot[bot]')) }} | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| # actionlint 1.7.12 does not accept the $/ self-repository form yet. | ||
| uses: ./.github/workflows/ci-c-e2e-mqttv5-adr-namespace.yml # zizmor: ignore[self-repository] | ||
| secrets: | ||
| AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
|
|
||
| custom-topics: | ||
| name: custom topics / linux | ||
| needs: adr-namespace | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install ninja | ||
| run: sudo apt-get update && sudo apt-get install -y ninja-build | ||
|
|
||
| - name: Build | ||
| working-directory: c | ||
| run: | | ||
| cmake --preset linux-gcc-debug -DAZ_IOT_BUILD_E2E=ON -DAZ_IOT_BUILD_E2E_MQTTV5=ON -DAZ_IOT_WITH_PAHO=ON | ||
| cmake --build --preset linux-gcc-debug --target az_iot_tests_e2e_mqttv5_custom_topic | ||
|
|
||
| - name: Issue a device | ||
| shell: pwsh | ||
| env: | ||
| E2E_MQTTV5_SHARED_GROUP_CA: ${{ secrets.E2E_MQTTV5_SHARED_GROUP_CA }} | ||
| E2E_MQTTV5_SHARED_IOTHUB_CS: ${{ secrets.E2E_MQTTV5_SHARED_IOTHUB_CS }} | ||
| E2E_MQTTV5_SHARED_EVENTHUB_CS: ${{ secrets.E2E_MQTTV5_SHARED_EVENTHUB_CS }} | ||
| E2E_MQTTV5_SHARED_SAS_GROUP_KEY: ${{ secrets.E2E_MQTTV5_SHARED_SAS_GROUP_KEY }} | ||
| E2E_MQTTV5_SHARED_ID_SCOPE: ${{ vars.E2E_MQTTV5_SHARED_ID_SCOPE }} | ||
| E2E_MQTTV5_SHARED_DPS_HOST: ${{ vars.E2E_MQTTV5_SHARED_DPS_HOST }} | ||
| E2E_REGISTRATION_ID: ci-mqttv5-ct-${{ github.run_id }}-${{ github.run_attempt }} | ||
| E2E_RUN_ID: ${{ github.run_id }} | ||
| # Consumer groups e2e-0..e2e-9; Event Hubs allows 5 readers per partition per group. | ||
| run: | | ||
| $group = 'e2e-' + ([long]$env:E2E_RUN_ID % 10) | ||
| ./c/eng/e2e-shared-device.ps1 -Prefix E2E_MQTTV5_SHARED -RegistrationId $env:E2E_REGISTRATION_ID ` | ||
| -ConsumerGroup $group -OutFile test_config/set_test_env_vars.ps1 | ||
|
|
||
| - name: Run | ||
| shell: pwsh | ||
| env: | ||
| # The hub acknowledges custom topic publishes but does not deliver them to the | ||
| # events endpoint yet; the routed cases skip until it does. Remove when fixed. | ||
| AZ_IOT_E2E_SKIP_CUSTOM_TOPIC_ROUTING: '1' | ||
| run: | | ||
| . ./test_config/set_test_env_vars.ps1 | ||
| $dir = Join-Path ([System.IO.Path]::GetTempPath()) ('az-iot-c-e2e-' + [Guid]::NewGuid().ToString('N')) | ||
| New-Item -ItemType Directory -Path $dir -Force | Out-Null | ||
| $cert = Join-Path $dir 'device-cert.pem' | ||
| $key = Join-Path $dir 'device-key.pem' | ||
| [System.IO.File]::WriteAllText($cert, | ||
| [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:IOT_DPS_INDIVIDUAL_X509_CERTIFICATE_0))) | ||
| [System.IO.File]::WriteAllText($key, | ||
| [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:IOT_DPS_INDIVIDUAL_X509_KEY_0))) | ||
|
|
||
| $env:AZ_IOT_DPS_ID_SCOPE = $env:IOT_DPS_ID_SCOPE | ||
| $env:AZ_IOT_DPS_REGISTRATION_ID = $env:IOT_DPS_INDIVIDUAL_REGISTRATION_ID_0 | ||
| $env:AZ_IOT_CLIENT_CERT = $cert | ||
| $env:AZ_IOT_CLIENT_KEY = $key | ||
| $env:AZ_IOT_TRUSTED_CA = '/etc/ssl/certs/ca-certificates.crt' | ||
| if ($env:IOT_DPS_GLOBAL_ENDPOINT) { $env:AZ_IOT_DPS_GLOBAL_ENDPOINT = $env:IOT_DPS_GLOBAL_ENDPOINT } | ||
|
|
||
| ctest --test-dir c/build/linux-gcc-debug -R e2e_mqttv5_custom_topic ` | ||
| --verbose --no-tests=error --timeout 900 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.