Skip to content
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

Test | Fix Unit Tests for GetSqlServerSPN #2442

Merged
merged 19 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
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 Apr 3, 2024
f6f5d2e
Revert changes to Nuget.config.
arellegue Apr 3, 2024
3681b82
Applied suggestions in PR review.
arellegue Apr 3, 2024
940b4e7
Added comment for usage of port and use Trim() for all usage of token…
arellegue Apr 12, 2024
0f7c222
Added DataSource Parser Test of the DataTestUtility class.
arellegue Apr 12, 2024
a2f78d0
Added test cases of DataSource Parser with trailing, leading and embe…
arellegue Apr 12, 2024
76cd350
Reverted change to SNIProxy.cs so it no longer does force initializat…
arellegue Apr 26, 2024
b2ef4c5
Remove unused usings.
arellegue May 6, 2024
57ea9e6
Revert all changes in SNIProxy.cs.
arellegue May 10, 2024
00a5961
Remove blank line at line 722 in SNIProxy.cs.
arellegue May 10, 2024
0086bfb
Add comment that the instance name is set in the SNI Proxy object fro…
arellegue May 10, 2024
43dee59
Merged from upstream main.
arellegue May 24, 2024
291d3a7
Changed pre-processor NETCOREAPP to NET6_0_OR_GREATER.
arellegue May 24, 2024
8a87c72
Applied suggested change.
arellegue Jun 18, 2024
14c4b03
Merge branch 'main' into SPNPortNumberUnitTests
arellegue Jul 5, 2024
81c2891
Merge branch 'main' into SPNPortNumberUnitTests
arellegue Jul 16, 2024
050af61
Merge branch 'main' into SPNPortNumberUnitTests
arellegue Jul 30, 2024
df929e3
Merge remote-tracking branch 'upstream/main' into SPNPortNumberUnitTests
DavoudEshtehari Aug 23, 2024
d047321
Removed test case for named pipe protocol as the parsing for tcp pro…
arellegue Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert all changes in SNIProxy.cs.
  • Loading branch information
arellegue committed May 10, 2024
commit 57ea9e6a413fa0386aa8cabd3f9385604696876a
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ internal static SNIHandle CreateConnectionHandle(
case DataSource.Protocol.TCP:
sniHandle = CreateTcpHandle(details, timeout, parallel, ipPreference, cachedFQDN, ref pendingDNSInfo,
tlsFirst, hostNameInCertificate, serverCertificateFilename);
break;
break;
case DataSource.Protocol.NP:
sniHandle = CreateNpHandle(details, timeout, parallel, tlsFirst);
break;
Expand Down Expand Up @@ -651,7 +651,6 @@ private bool InferConnectionDetails()
return false;
}

// If user is connecting to a managed instance with port, e.g. localhost\INSTANCENAME,1434
Port = port;
}
// Instance Name Handling. Only if we found a '\' and we did not find a port in the Data Source
Expand Down Expand Up @@ -695,7 +694,7 @@ private bool InferNamedPipesInformation()
if (!_dataSourceAfterTrimmingProtocol.Contains(PipeBeginning))
{
// Assuming that user did not change default NamedPipe name, if the datasource is in the format servername\instance,
// separate server name and instance and prepend instance with MSSQL$ and append default pipe path
// separate servername and instance and prepend instance with MSSQL$ and append default pipe path
// https://learn.microsoft.com/en-us/sql/tools/configuration-manager/named-pipes-properties?view=sql-server-ver16
if (_dataSourceAfterTrimmingProtocol.Contains(PathSeparator) && _connectionProtocol == Protocol.NP)
{
Expand All @@ -704,7 +703,7 @@ private bool InferNamedPipesInformation()
{
// NamedPipeClientStream object will create the network path using PipeHostName and PipeName
// and can be seen in its _normalizedPipePath variable in the format \\servername\pipe\MSSQL$<instancename>\sql\query
PipeHostName = ServerName = tokensByBackSlash[0].Trim();
PipeHostName = ServerName = tokensByBackSlash[0];
PipeName = $"{InstancePrefix}{tokensByBackSlash[1]}{PathSeparator}{DefaultPipeName}";
}
else
Expand Down Expand Up @@ -737,7 +736,7 @@ private bool InferNamedPipesInformation()
return false;
}

string host = tokensByBackSlash[2].Trim();
string host = tokensByBackSlash[2];

if (string.IsNullOrEmpty(host))
{
Expand All @@ -754,7 +753,7 @@ private bool InferNamedPipesInformation()

if (tokensByBackSlash[4].StartsWith(NamedPipeInstanceNameHeader, StringComparison.Ordinal))
{
InstanceName = tokensByBackSlash[4].Substring(NamedPipeInstanceNameHeader.Length).Trim();
InstanceName = tokensByBackSlash[4].Substring(NamedPipeInstanceNameHeader.Length);
}

StringBuilder pipeNameBuilder = new StringBuilder();
Expand Down
Loading