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

Fix | Fix unit test for SPN to include port number with Managed SNI #2281

Merged
merged 21 commits into from Feb 26, 2024

Conversation

arellegue
Copy link
Contributor

@arellegue arellegue commented Dec 21, 2023

This PR is for the Unit Test for the fix of Issue #2187

This PR contains the unit test for the GetSqlServerSPN method inside MDS driver where when a tcp protocol and named instance is used in the data source, it used to return the named instance name instead of the port number.

This PR's unit test is testing TCP protocol with a Named Instance with a port number in a data source specified.

Copy link

codecov bot commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.67%. Comparing base (5e07b29) to head (0c5ed6f).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2281      +/-   ##
==========================================
+ Coverage   72.61%   72.67%   +0.05%     
==========================================
  Files         310      310              
  Lines       61877    61875       -2     
==========================================
+ Hits        44935    44968      +33     
+ Misses      16942    16907      -35     
Flag Coverage Δ
addons 92.88% <ø> (ø)
netcore 76.94% <100.00%> (+0.08%) ⬆️
netfx 70.14% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@H-Yeo H-Yeo self-requested a review January 5, 2024 00:15
Copy link
Contributor

@H-Yeo H-Yeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things to me. More around consistency and readability.

Copy link
Contributor

@H-Yeo H-Yeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things to me. More around consistency and readability.

Copy link
Contributor

@H-Yeo H-Yeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from my last re-mark. Looks good to me.

@DavoudEshtehari DavoudEshtehari added the Ⓜ️ Managed SNI Use this label if the issue/PR relates to issues in Managed SNI label Jan 15, 2024
@kf-gonzalez kf-gonzalez added this to the 5.2.0 milestone Jan 24, 2024
@H-Yeo H-Yeo modified the milestones: 5.2.0, 5.2.0-preview5 Jan 24, 2024
Rename variables to what they are.
Changed ConditionalTheory to ConditionalFact and get the port number of named instance from Sql Browser.
…ort number agains port number returned in SPN.
Copy link
Contributor

@H-Yeo H-Yeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finished with my review. Just some comments on things I missed the first time around. Please review, make changes as necessary.

@arellegue arellegue requested a review from H-Yeo February 1, 2024 16:30
@H-Yeo
Copy link
Contributor

H-Yeo commented Feb 1, 2024

LGTM

@arellegue
Copy link
Contributor Author

LGTM

Are you going to approve?

Copy link
Contributor

@H-Yeo H-Yeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left an optional fix. I know this has been sitting here for awhile, and this is for a test. The only concern I have is reflection for the test, which I'm not an expert on. The 2nd reviewer/approver may have more changes to the usage of reflection.

int port = 0;

bool isDataSourceValid = DataTestUtility.ParseDataSource(builder.DataSource, out hostname, out _, out instanceName);
Assert.True(isDataSourceValid, "DataSource is invalid");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Optional] - Not a deal breaker for me. But this is missing a period for consistency.

@JRahnama JRahnama added ✔️ Tests Identifier for test related changes Ⓜ️ Managed SNI Use this label if the issue/PR relates to issues in Managed SNI and removed Ⓜ️ Managed SNI Use this label if the issue/PR relates to issues in Managed SNI ✔️ Tests Identifier for test related changes labels Feb 13, 2024
@DavoudEshtehari DavoudEshtehari merged commit 94c089e into dotnet:main Feb 26, 2024
148 checks passed
JRahnama added a commit to JRahnama/SqlClient that referenced this pull request Mar 7, 2024
JRahnama added a commit to JRahnama/SqlClient that referenced this pull request Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ⓜ️ Managed SNI Use this label if the issue/PR relates to issues in Managed SNI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants