-
Notifications
You must be signed in to change notification settings - Fork 314
Test | Fix Unit Tests for GetSqlServerSPN #2442
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
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8ddd3fc
Add fixes in SNIProxy to initialize InstanceName from data source.
arellegue f6f5d2e
Revert changes to Nuget.config.
arellegue 3681b82
Applied suggestions in PR review.
arellegue 940b4e7
Added comment for usage of port and use Trim() for all usage of token…
arellegue 0f7c222
Added DataSource Parser Test of the DataTestUtility class.
arellegue a2f78d0
Added test cases of DataSource Parser with trailing, leading and embe…
arellegue 76cd350
Reverted change to SNIProxy.cs so it no longer does force initializat…
arellegue b2ef4c5
Remove unused usings.
arellegue 57ea9e6
Revert all changes in SNIProxy.cs.
arellegue 00a5961
Remove blank line at line 722 in SNIProxy.cs.
arellegue 0086bfb
Add comment that the instance name is set in the SNI Proxy object fro…
arellegue 43dee59
Merged from upstream main.
arellegue 291d3a7
Changed pre-processor NETCOREAPP to NET6_0_OR_GREATER.
arellegue 8a87c72
Applied suggested change.
arellegue 14c4b03
Merge branch 'main' into SPNPortNumberUnitTests
arellegue 81c2891
Merge branch 'main' into SPNPortNumberUnitTests
arellegue 050af61
Merge branch 'main' into SPNPortNumberUnitTests
arellegue df929e3
Merge remote-tracking branch 'upstream/main' into SPNPortNumberUnitTests
DavoudEshtehari d047321
Removed test case for named pipe protocol as the parsing for tcp pro…
arellegue 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
75 changes: 75 additions & 0 deletions
75
...crosoft.Data.SqlClient/tests/ManualTests/SQL/DataSourceParserTest/DataSourceParserTest.cs
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,75 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Xunit; | ||
|
||
namespace Microsoft.Data.SqlClient.ManualTesting.Tests.SQL.DataSourceParserTest | ||
{ | ||
public class DataSourceParserTest | ||
{ | ||
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))] | ||
[InlineData("localhost")] | ||
[InlineData("tcp:localhost")] | ||
[InlineData(" localhost ")] | ||
[InlineData(" tcp:localhost ")] | ||
[InlineData(" localhost")] | ||
[InlineData(" tcp:localhost")] | ||
[InlineData("localhost ")] | ||
[InlineData("tcp:localhost ")] | ||
public void ParseDataSourceWithoutInstanceNorPortTestShouldSucceed(string dataSource) | ||
{ | ||
DataTestUtility.ParseDataSource(dataSource, out string hostname, out _, out _); | ||
Assert.Equal("localhost", hostname); | ||
} | ||
|
||
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))] | ||
[InlineData("localhost,1433")] | ||
[InlineData("tcp:localhost,1433")] | ||
[InlineData(" localhost,1433 ")] | ||
[InlineData(" tcp:localhost,1433 ")] | ||
[InlineData(" localhost,1433")] | ||
[InlineData(" tcp:localhost,1433")] | ||
[InlineData("localhost,1433 ")] | ||
[InlineData("tcp:localhost,1433 ")] | ||
public void ParseDataSourceWithoutInstanceButWithPortTestShouldSucceed(string dataSource) | ||
{ | ||
DataTestUtility.ParseDataSource(dataSource, out string hostname, out int port, out _); | ||
Assert.Equal("localhost", hostname); | ||
Assert.Equal(1433, port); | ||
} | ||
|
||
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))] | ||
[InlineData("localhost\\MSSQLSERVER02")] | ||
[InlineData("tcp:localhost\\MSSQLSERVER02")] | ||
[InlineData(" localhost\\MSSQLSERVER02 ")] | ||
[InlineData(" tcp:localhost\\MSSQLSERVER02 ")] | ||
[InlineData(" localhost\\MSSQLSERVER02")] | ||
[InlineData(" tcp:localhost\\MSSQLSERVER02")] | ||
[InlineData("localhost\\MSSQLSERVER02 ")] | ||
[InlineData("tcp:localhost\\MSSQLSERVER02 ")] | ||
public void ParseDataSourceWithInstanceButWithoutPortTestShouldSucceed(string dataSource) | ||
{ | ||
DataTestUtility.ParseDataSource(dataSource, out string hostname, out _, out string instanceName); | ||
Assert.Equal("localhost", hostname); | ||
Assert.Equal("MSSQLSERVER02", instanceName); | ||
} | ||
|
||
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))] | ||
[InlineData("localhost\\MSSQLSERVER02,1433")] | ||
[InlineData("tcp:localhost\\MSSQLSERVER02,1433")] | ||
[InlineData(" localhost\\MSSQLSERVER02,1433 ")] | ||
[InlineData(" tcp:localhost\\MSSQLSERVER02,1433 ")] | ||
[InlineData(" localhost\\MSSQLSERVER02,1433")] | ||
[InlineData(" tcp:localhost\\MSSQLSERVER02,1433")] | ||
[InlineData("localhost\\MSSQLSERVER02,1433 ")] | ||
[InlineData("tcp:localhost\\MSSQLSERVER02,1433 ")] | ||
public void ParseDataSourceWithInstanceAndPortTestShouldSucceed(string dataSource) | ||
{ | ||
DataTestUtility.ParseDataSource(dataSource, out string hostname, out int port, out string instanceName); | ||
Assert.Equal("localhost", hostname); | ||
Assert.Equal("MSSQLSERVER02", instanceName); | ||
Assert.Equal(1433, port); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
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.