-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Beta LiveTests #30728
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
Merged
l0lawrence
merged 26 commits into
Azure:feature/eventgrid
from
l0lawrence:beta_livetest
Aug 25, 2023
Merged
Beta LiveTests #30728
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3a2f6f8
add bicep file for tests
l0lawrence bec9820
update output
l0lawrence aa49345
update test
l0lawrence ee38e37
secret sanitization
l0lawrence d7c4a45
refactor failing test
l0lawrence 9d2ad55
update conftest
l0lawrence 68812c3
update assets and sanitizers
l0lawrence 26f89c0
update preparer loc
l0lawrence 9d34f6d
update conftest
l0lawrence f4647d0
conftest
l0lawrence ab2e095
update conftest
l0lawrence 63a7d08
remove variables for now
l0lawrence 7bfd496
update assets
l0lawrence 19aa3ae
update tests
l0lawrence bd2691d
try to update regex
l0lawrence ebd4dbe
update recordings
l0lawrence 6b6ddbb
update conftest
l0lawrence 882cf3b
update preparer
l0lawrence 91251aa
update test
l0lawrence 53eba60
update exception test
l0lawrence 7f69df2
update tests
l0lawrence 8c697c4
update asset
l0lawrence 12bbdff
update conftest
l0lawrence d8b20e1
pr comments
l0lawrence 217d266
default needs to be eastus
l0lawrence 66c3112
import
l0lawrence 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
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
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,78 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # -------------------------------------------------------------------------- | ||
| import pytest | ||
| import os | ||
| import time | ||
| from devtools_testutils import AzureRecordedTestCase, recorded_by_proxy | ||
| from azure.eventgrid import EventGridClient | ||
| from azure.eventgrid.models import * | ||
| from azure.core.messaging import CloudEvent | ||
| from azure.core.credentials import AzureKeyCredential | ||
|
|
||
| from eventgrid_preparer import EventGridPreparer | ||
|
|
||
|
|
||
| class TestEGClientExceptions(AzureRecordedTestCase): | ||
| def create_eg_client(self, endpoint, key): | ||
| client = EventGridClient( | ||
| endpoint=endpoint, credential=AzureKeyCredential(key) | ||
| ) | ||
| return client | ||
|
|
||
| @pytest.mark.skip("need to update conftest") | ||
| @EventGridPreparer() | ||
| @recorded_by_proxy | ||
| def test_publish_receive_cloud_event(self, eventgrid_endpoint, eventgrid_key, eventgrid_topic_name, eventgrid_event_subscription_name): | ||
| client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) | ||
|
|
||
| event = CloudEvent( | ||
| type="Contoso.Items.ItemReceived", | ||
| source="source", | ||
| subject="MySubject", | ||
| data=b'this is binary data', | ||
| ) | ||
|
|
||
| client.publish_cloud_events( | ||
| eventgrid_topic_name, body=[event] | ||
| ) | ||
|
|
||
| time.sleep(5) | ||
|
|
||
| events = client.receive_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name,max_events=1) | ||
| lock_token = events.value[0].broker_properties.lock_token | ||
|
|
||
| ack = client.acknowledge_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, lock_tokens=AcknowledgeOptions(lock_tokens=[lock_token])) | ||
| assert len(ack.succeeded_lock_tokens) == 1 | ||
| assert len(ack.failed_lock_tokens) == 0 | ||
|
|
||
| @pytest.mark.skip("need to update conftest") | ||
swathipil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @EventGridPreparer() | ||
| @recorded_by_proxy | ||
| def test_publish_release_cloud_event(self, eventgrid_endpoint, eventgrid_key, eventgrid_topic_name, eventgrid_event_subscription_name): | ||
| client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) | ||
|
|
||
| event = CloudEvent( | ||
| type="Contoso.Items.ItemReceived", | ||
| source="source", | ||
| subject="MySubject", | ||
| data=b'this is binary data', | ||
| ) | ||
|
|
||
| client.publish_cloud_events( | ||
| eventgrid_topic_name, body=[event] | ||
| ) | ||
|
|
||
| time.sleep(5) | ||
|
|
||
| events = client.receive_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, max_events=1) | ||
| lock_token = events.value[0].broker_properties.lock_token | ||
|
|
||
| ack = client.release_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, lock_tokens=ReleaseOptions(lock_tokens=[lock_token])) | ||
| assert len(ack.succeeded_lock_tokens) == 1 | ||
| assert len(ack.failed_lock_tokens) == 0 | ||
|
|
||
| events = client.receive_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, max_events=1) | ||
| assert events.value[0].broker_properties.delivery_count > 1 | ||
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.