-
Notifications
You must be signed in to change notification settings - Fork 6
fix(linux_dns_issue): Re-trying DNS lookup of instance name after appending the domain from AG listener #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ryan Clare (Kaneraz)
merged 14 commits into
factset:master
from
AdityaNPL:fix/linux_dns_issue
Mar 11, 2021
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0326cae
fix(linux_dns_issue): POC
AdityaNPL 890c293
fix(linux_dns_issue): compatible with dotnet 4.7 + summary docs
AdityaNPL 483e636
fix(linux_dns_issue): whitespace
AdityaNPL a76a81b
fix(linux_dns_issue): more whitespace
AdityaNPL fda9a11
feat(linux_dns_issue): Handling ports and named instances
AdityaNPL 8e22c6b
refactor(linux_dns_issue): some renames + removed the check to see i…
AdityaNPL 51a01e1
fix(linux_dns_issue): moved named instance handling to 'SplitDomainPo…
AdityaNPL ced0e8c
refactor(linux_dns_issue): PR suggestions + comments + renames
AdityaNPL 8e9a165
test(Listener): New tests for 'SplitDomainAndPort()'
AdityaNPL 3067f1c
refactor(Listener): Moving using statements back inside namespace
AdityaNPL 437c8ba
fix(linux_dns_issue): prefer adding back ports over named instances
AdityaNPL d48fc10
refactor(linux_dns_issue): renames
AdityaNPL 98ce65d
refactor(port preference): simplified if conditions
AdityaNPL d2b56c6
refactor(Listener.cs): PR suggestions for renames and test data
AdityaNPL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| using System.Collections.Generic; | ||
| using Xunit; | ||
|
|
||
| namespace AgDatabaseMove.Unit | ||
| { | ||
| public class SmoFacadeListenerTest | ||
| { | ||
|
|
||
| /// <summary> | ||
| /// Tests for Listener.SplitDomainAndPort() | ||
| /// </summary> | ||
|
|
||
| private const string DOMAIN = "abc.def.ghi"; | ||
| private const string HOST = "abc"; | ||
| private const string PORT = ",123"; | ||
| private const string NAMED_INSTANCE = "\\SQL"; | ||
| private const string BAD_PORT = ":123"; | ||
| private const string BAD_NAMED_INSTANCE = "SQL"; | ||
|
|
||
|
AdityaNPL marked this conversation as resolved.
|
||
| // {input, expectedDomain, expectedPort (can be null)} | ||
| public static IEnumerable<object[]> ValidPorts => new List<object[]> { | ||
| new object[] { DOMAIN, DOMAIN, null }, | ||
| new object[] { $"{DOMAIN}{PORT}", DOMAIN, PORT }, | ||
| new object[] { $"{DOMAIN}{NAMED_INSTANCE}", DOMAIN, NAMED_INSTANCE }, | ||
|
|
||
| new object[] { HOST, HOST, null }, | ||
| new object[] { $"{HOST}{PORT}", HOST, PORT }, | ||
| new object[] { $"{HOST}{NAMED_INSTANCE}", HOST, NAMED_INSTANCE } | ||
| }; | ||
|
|
||
| [Theory, MemberData(nameof(ValidPorts))] | ||
| public void ValidPortTests(string input, string expectedDomain, string expectedPort=null) | ||
| { | ||
| var (domain, port) = SmoFacade.Listener.SplitDomainAndPort(input); | ||
| Assert.Equal(domain, expectedDomain); | ||
| Assert.Equal(port, expectedPort); | ||
| } | ||
|
|
||
| // {input, expectedDomain, expectedPort (can be null)} | ||
| public static IEnumerable<object[]> InvalidPorts => new List<object[]> { | ||
| new object[] { $"{DOMAIN}{BAD_PORT}", $"{DOMAIN}{BAD_PORT}", null }, | ||
| new object[] { $"{DOMAIN}{BAD_NAMED_INSTANCE}", $"{DOMAIN}{BAD_NAMED_INSTANCE}", null }, | ||
|
|
||
| new object[] { $"{HOST}{BAD_PORT}", $"{HOST}{BAD_PORT}", null }, | ||
| new object[] { $"{HOST}{BAD_NAMED_INSTANCE}", $"{HOST}{BAD_NAMED_INSTANCE}", null }, | ||
| }; | ||
|
|
||
| [Theory, MemberData(nameof(InvalidPorts))] | ||
| public void InvalidPortTests(string input, string expectedDomain, string expectedPort=null) | ||
| { | ||
| var (domain, port) = SmoFacade.Listener.SplitDomainAndPort(input); | ||
| Assert.Equal(domain, expectedDomain); | ||
| Assert.Equal(port, expectedPort); | ||
| } | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Tests for Listener.GetPreferredPort() | ||
| /// </summary> | ||
|
|
||
| private const string IPort = ",123"; | ||
| private const string INamed = "\\SQL"; | ||
|
|
||
| private const string LPort = ",321"; | ||
| private const string LNamed = "\\LQS"; | ||
|
|
||
| [Theory] | ||
| [InlineData(null, null, null)] | ||
| [InlineData(null, LPort, LPort)] | ||
| [InlineData(null, LNamed, LNamed)] | ||
| [InlineData(IPort, null, IPort)] | ||
| [InlineData(IPort, LPort, IPort)] | ||
| [InlineData(IPort, LNamed, IPort)] | ||
| [InlineData(INamed, null, INamed)] | ||
| [InlineData(INamed, LPort, LPort)] | ||
| [InlineData(INamed, LNamed, INamed)] | ||
| public void PortPreferenceTests(string instancePortOrNamedInstance, string listenerPortOrNamedInstance, string expectedResult) | ||
| { | ||
| var preferredPortOrNamedInstance = SmoFacade.Listener.GetPreferredPort(instancePortOrNamedInstance, listenerPortOrNamedInstance); | ||
| Assert.Equal(preferredPortOrNamedInstance, expectedResult); | ||
| } | ||
|
|
||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.