Fix DNS SRV provider ignoring query suffix - #7688
Open
Rimobul wants to merge 1 commit into
Open
Conversation
Fixes dotnet#7175 Infer Kubernetes namespace in DnsSrvServiceEndpointProviderFactory. Add tests for suffix normalization and ServiceDomainNameCallback precedence.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in Microsoft.Extensions.ServiceDiscovery.Dns where the DNS SRV query-building path ignored the normalized (dot-trimmed / Kubernetes-inferred) query suffix, causing SRV lookups to use the raw configured suffix instead of the computed one.
Changes:
- Use the factory’s normalized
_querySuffixwhen building the default SRV query name. - Add regression coverage for query-suffix normalization (
".ns"vs"ns"). - Add coverage ensuring
ServiceDomainNameCallbacktakes precedence overQuerySuffix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns/DnsSrvServiceEndpointProviderFactory.cs | Passes the normalized _querySuffix into default SRV query construction to avoid ignoring inferred/normalized suffix. |
| test/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/DnsSrvServiceEndpointResolverTests.cs | Adds regression tests for suffix normalization and callback precedence when generating SRV query names. |
Comment on lines
+36
to
+39
| /// <summary> | ||
| /// Regression test for https://github.com/dotnet/extensions/issues/7175: the query suffix used to build the SRV | ||
| /// query must be the normalized one, which has its leading dot trimmed and falls back to the inferred Kubernetes domain. | ||
| /// </summary> |
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.
Fixes #7175
Infer Kubernetes namespace in DnsSrvServiceEndpointProviderFactory.
Add tests for suffix normalization and ServiceDomainNameCallback precedence.
Microsoft Reviewers: Open in CodeFlow