Skip to content
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
7 changes: 6 additions & 1 deletion scripts/devops_tasks/test_run_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))

IGNORED_SAMPLES = {
"azure-eventgrid": ["__init__.py"]
"azure-eventgrid": [
"__init__.py",
"consume_cloud_events_from_eventhub.py",
"consume_cloud_events_from_service_bus_queue.py",
"consume_cloud_events_from_storage_queue.py",
"cs2_publish_custom_events_to_a_domain_topic.py"]
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from azure.eventgrid import EventGridConsumer

consumer = EventGridConsumer()
path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./cs3_system_event.json"))

with open('./cs3_event_grid_event_system_event.json', 'r') as f:
with open(path, 'r') as f:
eg_event_received_message = json.loads(f.read())
# returns List[DeserializedEvent]
event = consumer.decode_eventgrid_event(eg_event_received_message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from azure.eventgrid import EventGridConsumer

consumer = EventGridConsumer()
path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./cs4_event_grid_event_custom_event.json"))

with open('./cs4_event_grid_event_custom_event.json', 'r') as f:
with open(path, 'r') as f:
eg_event_received_message = json.loads(f.read())

# returns List[DeserializedEvent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from azure.eventgrid import EventGridConsumer

consumer = EventGridConsumer()
path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./cs6_cloud_event_system_event.json"))

with open('./cs6_cloud_event_system_event.json', 'r') as f:
with open(path, 'r') as f:
cloud_event_received_message = json.loads(f.read())

# returns List[DeserializedEvent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"specversion":"1.0"
}
cloud_custom_string = json.dumps(cloud_custom_dict)
cloud_custom_bytes = bytes(cloud_custom_string, "utf-8")
cloud_custom_bytes = str(cloud_custom_string).encode("utf-8")

client = EventGridConsumer()
deserialized_dict_event = client.decode_cloud_event(cloud_custom_dict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}

eg_storage_string = json.dumps(eg_storage_dict)
eg_storage_bytes = bytes(eg_storage_string, "utf-8")
eg_storage_bytes = str(eg_storage_string).encode("utf-8")

client = EventGridConsumer()
deserialized_dict_event = client.decode_eventgrid_event(eg_storage_dict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

def publish_event():
# publish events
for _ in range(10):
for _ in range(3):
event_list = [] # list of events to publish
# create events and append to list
for j in range(randint(1, 1)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def publish_event():
# publish events
for _ in range(10):
for _ in range(3):

event_list = [] # list of events to publish
team_members = ["Josh", "Kerri", "Kieran", "Laurent", "Lily", "Matt", "Soren", "Srikanta", "Swathi"] # possible values for data field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def publish_event():
}

# publish events
for _ in range(10):
for _ in range(3):

event_list = [] # list of events to publish
# create events and append to list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

def publish_event():
# publish events
while True:
for _ in range(3):

event_list = [] # list of events to publish
# create events and append to list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def publish_event():
# publish events
for _ in range(10):
for _ in range(3):

event_list = [] # list of events to publish
# create events and append to list
Expand Down
12 changes: 11 additions & 1 deletion sdk/eventgrid/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ jobs:
parameters:
ServiceDirectory: eventgrid
BuildTargetingString: azure-eventgrid*
TestSamples: true
EnvVars:
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
EG_ACCESS_KEY: $(python-sdk-test-eg-access-key)
EG_TOPIC_HOSTNAME: $(python-sdk-test-eg-topic-hostname)
CLOUD_ACCESS_KEY: $(python-sdk-test-eg-cloud-access-key)
CLOUD_TOPIC_HOSTNAME: $(python-sdk-test-eg-cloud-topic-hostname)
DOMAIN_ACCESS_KEY: $(python-sdk-test-eg-domain-access-key)
DOMAIN_TOPIC_HOSTNAME: $(python-sdk-test-eg-domain-topic-hostname)
DOMAIN_NAME: $(python-sdk-test-eg-domain-name)
CUSTOM_SCHEMA_ACCESS_KEY: $(python-sdk-test-eg-custom-schema-access-key)
CUSTOM_SCHEMA_TOPIC_HOSTNAME: $(python-sdk-test-custom-schema-topic-hostname)