Azure / Azure/azure-sdk-for-rust
[Event Hubs] Add live tests for producer routing and payload edge cases
- Dominant language
- Rust
- Stars
- 884
- Forks
- 365
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 109
Description
## Summary
The producer tests cover a single event send, a message send, a batch send, and a batch overload check. They do not assert partition key routing, and they do not cover payload edges. `test_add_amqp_messages_to_batch` builds AMQP value bodies and sequence bodies on the send side, but no test reads them back.
## Motivation
Partition key routing is a service side hash. Only a live test can prove that one key maps to one partition. Payload edges (a zero length body, an event near the size limit, an oversized event) exercise the encoder and the service limit check. Receive side validation of AMQP body types proves the round trip, not just the encode step. Part of #4886.
## Proposal
- [ ] All events in one batch with a partition key land on one partition, and repeated sends with the same key land on the same partition (.NET `ProducerCanSendAnEventBatchUsingAPartitionHashKey`, `ProducerSendsEventsWithTheSamePartitionHashKeyToTheSamePartition`).
- [ ] Send a zero length body event and receive it (.NET `ProducerCanSendZeroLengthSet`, `ConsumerCanReadSingleZeroLengthEvent`).
- [ ] Send a single event that is near the maximum message size and receive it (.NET `ProducerCanSendSingleLargeEventInASet`, `ConsumerCanReadSingleLargeEvent`).
- [ ] Sending an oversized event returns a size limit error (.NET `ProducerCannotSendSetLargerThanMaximumSize`).
- [ ] Validate AMQP value bodies, sequence bodies, and binary application properties on the receive side (.NET `ReceiverCanReadEventsWithAValueBody`, `ReceiverCanReadEventsWithASequenceBody`, `ConsumerCanReadEventsWithBinaryProperties`).
Batches carry a `partition_key`. Single event sends do not, because `SendEventOptions` has only `partition_id`. Write the partition key tests against batches.
## Validation
Deploy the test resources with `eng/common/TestResources/New-TestResources.ps1 -ServiceDirectory eventhubs`. Set `EVENTHUBS_HOST` and `EVENTHUB_NAME`. Then run `AZURE_TEST_MODE=live cargo test --package azure_messaging_eventhubs --test '*'`. Each new test passes in live mode.
Contributor guide
Assessment
This issue has not been assessed yet.