fix(azure): correct EventHubs emulator test client builder usage#11835
Open
kiview wants to merge 1 commit into
Open
fix(azure): correct EventHubs emulator test client builder usage#11835kiview wants to merge 1 commit into
kiview wants to merge 1 commit into
Conversation
…emulator test The EventHubClientBuilder.fullyQualifiedNamespace() call overrides the endpoint set by connectionString(), causing the SDK to resolve 'emulatorNs1' as a DNS hostname (emulatorNs1.eventhubs.emulator.net) instead of using the localhost endpoint from the connection string. Use the two-arg connectionString(connectionString, eventHubName) overload instead, which correctly sets both the endpoint (from the connection string) and the entity name without replacing the endpoint.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
EventHubsEmulatorContainerTest.testWithEventHubsClient()was failing with:The test called both
.connectionString(emulator.getConnectionString())and.fullyQualifiedNamespace("emulatorNs1")onEventHubClientBuilder. In the Azure SDK these two methods are mutually exclusive —.fullyQualifiedNamespace()overrides the endpoint from the connection string, causing the SDK to resolveemulatorNs1.eventhubs.emulator.netinstead of the mapped localhost port.Fix
Replace the broken chained calls with the two-arg
connectionString(connectionString, eventHubName)overload, which correctly sets both the endpoint and entity name:The emulator container implementation and config file (
eventhubs_config.json) are correct and unchanged.