Skip to content

Conversation

Hazhzeng
Copy link
Contributor

@Hazhzeng Hazhzeng commented Jul 10, 2020

Descriptions

  1. The single EventHub enqueue_time field now extract data from trigger_metadata['EnqueuedTimeUtc'] instead of trigger_metadata['EnqueuedTime'].
  2. The newly introduced ServiceBus properties expires_at_utc and enqueued_time_utc need to be exposed at _servicebus.py public interface.
  3. Add more robust tests in EventHub event properties and ServiceBus message properties.

@Hazhzeng Hazhzeng changed the title Fix eventhub enqueue time Fix eventhub enqueue time parsing Jul 10, 2020
@Hazhzeng Hazhzeng changed the title Fix eventhub enqueue time parsing Fix EnqueueTimeUtc parsing in EventHub and ServiceBus Jul 14, 2020
@Hazhzeng Hazhzeng changed the title Fix EnqueueTimeUtc parsing in EventHub and ServiceBus Fix EnqueueTimeUtc in EventHub and expose ServiceBus new properties Jul 14, 2020
@Hazhzeng Hazhzeng requested a review from vrdmr July 14, 2020 03:34
"MethodName": "ServiceBusSMany",
"UtcNow": "2020-06-18T05:39:12.2860411Z",
"RandGuid": "bb38deae-cc75-49f2-89f5-96ec6eb857db"
mocked_metadata['MessageReceiver'] = meta.Datum(type='json', value='''
Copy link
Member

Choose a reason for hiding this comment

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

This is the new section of metadata received?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is the new section of metadata provided by the extension. We still support the old mocked_metadata['sys'] in line 192.

# Datetime should be in iso8601 string instead of datetime object
metadata_dict = servicebus_msg.metadata
self.assertDictEqual(metadata_dict, {
self.assertGreaterEqual(metadata_dict.items(), {
Copy link
Member

Choose a reason for hiding this comment

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

Does this compare all the metadata items? If yes, then why the "Greater"?

Copy link
Contributor Author

@Hazhzeng Hazhzeng Aug 18, 2020

Choose a reason for hiding this comment

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

This test is amended to ensure the metadata_dict has the following expected fields (DeliveryCount, LockToken, ExpiresAtUtc...).

Using self.assertDictEqual is too strict for this test scenario. We just want to ensure the expected fields are a subset of the metadata, no need to be identical. I tried using self.assertDictContainsSubset but it has been deprecated in Python 3.6. So I first convert the dictionary into an ItemView (an item set) using .items(), and use self.assertGreaterEqual for subset check.

@Hazhzeng Hazhzeng requested a review from vrdmr August 18, 2020 20:56
Copy link
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

@Hazhzeng Hazhzeng merged commit 7156bf2 into dev Aug 18, 2020
@Hazhzeng Hazhzeng deleted the hazeng/enqueue-time-utc branch August 18, 2020 21:31
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