Skip to content

test: add ServiceBus SDK tests #1678

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
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented May 7, 2025

Description

Adds ServiceBus SDK-type bindings tests (using emulator)
Migrates Blob SDK-type binding tests to use emulators
Moves HttpV2 tests into E2E directory

Fixes #


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and CI is passing.

Quality of Code and Contribution Guidelines

@hallvictoria hallvictoria marked this pull request as ready for review May 8, 2025 16:25
…-worker into extensions/azurefunctions-extensions-bindings-servicebus/1.0.0b1
@@ -84,6 +84,7 @@ jobs:
env:
AzureWebJobsStorage: "UseDevelopmentStorage=true"
AzureWebJobsEventHubConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
AZURE_STORAGE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A different connection string value (instead of UseDevelopmentStorage=true is needed when interacting with the SDK and using emulators. Same goes for ServiceBus

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't git flag this while pushing? The repo might get flagged coz of the key in the connection string

@@ -150,7 +150,7 @@ jobs:
Write-Host "skipTest: $(skipTest)"
displayName: 'Display skipTest variable'
- bash: |
python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend tests/extension_tests/deferred_bindings_tests tests/extension_tests/http_v2_tests
python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the extension_tests folder anymore -- blob SDK bindings tests are moved to emulators folder, and HttpV2 moved to E2E

@@ -79,7 +79,8 @@ dev = [
"numpy",
"pre-commit",
"invoke",
"cryptography"
"cryptography",
"jsonpickle"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added jsonpickle to help with the SB tests. Majority of the properties of the ServiceBusReceivedMessage were not JSON-serializable, and I wanted to keep the same general test structure as the current SB tests

return testutils.EXTENSION_TESTS_FOLDER / 'deferred_bindings_tests' / \
'deferred_bindings_blob_functions'
return testutils.EMULATOR_TESTS_FOLDER / 'blob_functions' / \
'blob_functions_sdk'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For naming conventions, I went with <binding>_functions_sdk to match <binding>_functions_stein, but open to other ways like blob_sdk_functions if that's preferable

@@ -84,6 +84,7 @@ jobs:
env:
AzureWebJobsStorage: "UseDevelopmentStorage=true"
AzureWebJobsEventHubConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
AZURE_STORAGE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't git flag this while pushing? The repo might get flagged coz of the key in the connection string

@@ -84,6 +84,7 @@ jobs:
env:
AzureWebJobsStorage: "UseDevelopmentStorage=true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still being used or can it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's used by the non-SDK bindings blob tests

@app.service_bus_queue_trigger(
arg_name="msg",
connection="AzureWebJobsServiceBusSDKConnectionString",
queue_name="testqueue")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test for SB topics?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the extension support topics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants