Azure / Azure/azure-sdk-for-rust

[Event Hubs] Add live tests for owner level (epoch) arbitration

Open
#4,888 0 comments 1 reaction 1 assignee Claimed by @j7nw4r View on GitHub
Client Event Hubs test-enhancement
Dominant language
Rust
Stars
884
Forks
365
Avg merge
2d 19h
Merged PRs (30d)
112

Description

## Summary

`OpenReceiverOptions` supports `owner_level`, but no live test sets it directly. The only coverage is indirect: `second_processor_displaces_first_with_consumer_disconnected` in `eventhubs_processor.rs` exercises one displacement path through the event processor. .NET has about 10 tests each in `EventHubConsumerClientLiveTests` and `PartitionReceiverLiveTests`.

## Motivation

Owner level is how the service arbitrates between competing readers on one partition. The broker decides who wins and who gets disconnected, so only a live test can prove the behavior. This logic also underpins the event processor, so a regression here breaks partition ownership. Part of #4886.

## Proposal

- [ ] An exclusive receiver displaces an active non exclusive receiver on the same partition (.NET `ExclusiveConsumerSupersedesNonExclusiveActiveReader`).
- [ ] A receiver with a higher owner level displaces a receiver with a lower owner level (.NET `ConsumerWithHigherOwnerLevelSupersedesActiveReader`).
- [ ] A receiver with a lower owner level cannot open while a higher level receiver is active (.NET `ConsumerCannotReadWithLowerOwnerLevelThanActiveReader`).
- [ ] Displacement does not cross partitions and does not cross consumer groups (.NET `ExclusiveConsumerDoesNotSupersedeNonExclusiveActiveReaderOnAnotherPartition` and the consumer group twin).

The test namespace is shared across the whole suite. Use distinct consumer groups or distinct partitions in these tests, so that a displacement in one test does not disturb another test.

## 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, and the tests pass when the full suite runs together.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.