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

Enable tests for integration samples #18531

Merged
merged 10 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 8 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
8 changes: 4 additions & 4 deletions scripts/devops_tasks/test_run_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
}
"""
TIMEOUT_SAMPLES = {
"azure-eventgrid": {
"consume_cloud_events_from_storage_queue.py": (10),
},
"azure-eventhub": {
"receive_batch_with_checkpoint.py": (10),
"recv.py": (10),
Expand Down Expand Up @@ -76,10 +79,7 @@
"azure-eventgrid": [
"__init__.py",
"consume_cloud_events_from_eventhub.py",
"consume_eventgrid_events_from_service_bus_queue.py",
"consume_cloud_events_from_storage_queue.py",
"sample_publish_events_to_a_topic_using_sas_credential.py",
"sample_publish_events_to_a_topic_using_sas_credential_async.py"],
"consume_eventgrid_events_from_service_bus_queue.py"],
"azure-eventhub": [
"connection_to_custom_endpoint_address.py",
"proxy.py",
Expand Down
1 change: 1 addition & 0 deletions sdk/eventgrid/azure-eventgrid/dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
-e ../../core/azure-core
-e ../../identity/azure-identity
-e ../azure-mgmt-eventgrid
azure-storage-queue
aiohttp>=3.0; python_version >= '3.5'
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
1) EVENT_HUB_CONN_STR: The connection string to the Event hub account
3) EVENTHUB_NAME: The name of the eventhub account
"""

# Note: This sample would not work on pypy since one of the dependencies
# of azure-eventhub is not pypy compatible.
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved

import os
import json
from azure.core.messaging import CloudEvent
from azure.eventhub import EventHubConsumerClient

CONNECTION_STR = os.environ["EVENT_HUB_CONN_STR"]
EVENTHUB_NAME = os.environ["EVENTHUB_NAME"]
EVENTHUB_NAME = os.environ["EVENT_HUB_NAME"]


def on_event(partition_context, event):

dict_event = CloudEvent.from_dict(json.loads(event)[0])
print("data: {}\n".format(deserialized_event.data))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import json

# all types of CloudEvents below produce same DeserializedEvent
connection_str = os.environ['STORAGE_QUEUE_CONN_STR']
connection_str = os.environ['AZURE_STORAGE_CONNECTION_STRING']
queue_name = os.environ['STORAGE_QUEUE_NAME']

with QueueServiceClient.from_connection_string(connection_str) as qsc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
1) SB_CONN_STR: The connection string to the Service Bus account
3) SERVICE_BUS_QUEUE_NAME: The name of the servicebus account
"""

# Note: This sample would not work on pypy since one of the dependencies
# of azure-eventhub is not pypy compatible.
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved
rakshith91 marked this conversation as resolved.
Show resolved Hide resolved

from azure.eventgrid import EventGridEvent
from azure.servicebus import ServiceBusClient
import os
import json

# all types of EventGridEvents below produce same DeserializedEvent
connection_str = os.environ['SERVICE_BUS_CONN_STR']
connection_str = os.environ['SERVICE_BUS_CONNECTION_STR']
queue_name = os.environ['SERVICE_BUS_QUEUE_NAME']

with ServiceBusClient.from_connection_string(connection_str) as sb_client:
Expand Down
2 changes: 2 additions & 0 deletions sdk/eventgrid/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ stages:
BuildTargetingString: azure-eventgrid*
TestSamples: true
EnvVars:
AZURE_STORAGE_CONNECTION_STRING: $(python-storage-blob-connection-string)
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
Expand All @@ -21,5 +22,6 @@ stages:
EG_DOMAIN_TOPIC_HOSTNAME: $(python-sdk-test-domain-topic-hostname-eg)
EVENTGRID_SAS: $(python-sdk-test-eg-sas)
DOMAIN_NAME: $(python-sdk-test-eg-domain-name)
STORAGE_QUEUE_NAME: $(python-storage-queue-name)
CUSTOM_SCHEMA_ACCESS_KEY: $(python-sdk-test-eg-custom-schema-access-key)
CUSTOM_SCHEMA_TOPIC_HOSTNAME: $(python-sdk-test-custom-schema-topic-hostname)