This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
SqlClient Manual Test fixes and documentation update #34546
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
349ac63
add IsUsingNativeSNI, IsUFT8Supported DataUtility methods for conditions
Wraith2 39e33ae
fixup syncroot check after changes in PR 34198
Wraith2 0705eba
disable tests in managed mode affected by 33930
Wraith2 640e3ed
add UdtTestDatabase creatiuon script
Wraith2 652f5c1
re-add UTF8 test using guard condition
Wraith2 e4ced62
addressed feedback
Wraith2 ec2c252
address feedback
Wraith2 7f396d1
address feedback
Wraith2 5456a4c
address feedback
Wraith2 fe85a32
Merge remote-tracking branch 'dotnet/master' into sqltests-updates
Wraith2 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 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 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 |
---|---|---|
@@ -1,6 +1,41 @@ | ||
# SqlClient Manual Tests | ||
|
||
These tests require dedicated test servers, so they're designed to be run manually using a custom set of connection strings. These connection strings should be added as environment variables: TEST\_NP\_CONN\_STR & TEST\_TCP\_CONN\_STR. TEST\_NP\_CONN\_STR is a named pipes connection string to the test server, and TEST\_TCP\_CONN\_STR is a TCP connection string. Each protocol can be specified in the Server name parameter. These tests also assume the sample database "Northwind" exists in the target server. This sample database can be found [here](https://msdn.microsoft.com/en-us/library/mt710790.aspx). | ||
These tests require dedicated test servers, so they're designed to be run manually using a custom set of connection strings. | ||
|
||
Instructions for running tests: [Unix](https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-platform-testing.md) and [Windows](https://github.com/dotnet/corefx/blob/master/Documentation/building/windows-instructions.md). | ||
Documentation for connection string parameters: [SqlConnection.ConnectionString](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx). | ||
## Prerequisites | ||
|
||
- CoreFX building. you need to be able to do a successful build and run the standard tests, [Unix](https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-platform-testing.md) or [Windows](https://github.com/dotnet/corefx/blob/master/Documentation/building/windows-instructions.md) Use build.cmd for windows and build.sh for Linux to build CoreFX. | ||
|
||
**N.B.** if you want to run the EFCore tests later you will need to build -allconfigurations to generate the NuGet packages, build -allconfigurations works only on windows. | ||
|
||
- an [MS SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-editions-express) (any edition) 2012 or later that you can connect to with tcp and named pipes, | ||
|
||
**N.B**. if you want to run the EFCore tests it should be a dedicated instance because they create a lot of databases. | ||
|
||
- The [Northwind Sample Database](https://msdn.microsoft.com/en-us/library/mt710790.aspx) | ||
|
||
- The [UDT Test Database](https://github.com/dotnet/corefx/tree/master/src/System.Data.SqlClient/tests/ManualTests/createUdtTestDb_corefx.sql) | ||
|
||
- TCP and Named Pipe [connection strings](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx) to your instance with Northwind set as the initial catalog | ||
|
||
|
||
|
||
## Running All Tests | ||
|
||
1. run `build src\System.Data.SqlClient -allconfigurations` and make sure the builds all work | ||
|
||
2. set the environment variables needed for the tests you want. At the minimum you need to set | ||
`TEST_NP_CONN_STR` and `TEST_TCP_CONN_STR` to the connection strings. | ||
|
||
3. Optionally you may also want to setup other environment variables to test specific optional features such as [TEST_LOCALDB_INSTALLED](https://github.com/dotnet/corefx/blob/8f7b490ca874ee2a9f11f0163412f7c95811298b/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs#L96) or [TEST_INTEGRATEDSECURITY_SETUP](https://github.com/dotnet/corefx/blob/8f7b490ca874ee2a9f11f0163412f7c95811298b/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs#L98). Other scenarios lke azure tests may need configuration so if you see those being skipped and you want to run them invesigate the skipped test code to identify how to configure it. | ||
|
||
4. run `dotnet msbuild .\src\System.Data.SqlClient\tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj /t:Rebuild` to build the debug version with all the assertions and run the tests. | ||
|
||
5. If you need to re-run the test suite without having changed the build (e.g. if you've changed the exnvironment variables) you can use `dotnet msbuild .\src\System.Data.SqlClient\tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj /t:Test` | ||
|
||
|
||
|
||
## Running A Specific Test | ||
|
||
Once you have all tests running you may need to debug a single failing test. To do this navigate into the manual tests project directory `cd src\System.Data.SqlClient\tests\ManualTests` then run dotnet msbuild and specify the name of the test you want to execute, like this: | ||
`dotnet msbuild /t:RebuildAndTest /p:XunitMethodName=System.Data.SqlClient.ManualTesting.Tests.DDDataTypesTest.MaxTypesTest` |
This file contains 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 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 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 & 4 can be combined into a single statement
dotnet msbuild .\src\System.Data.SqlClient\tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj /t:RebuildAndTest
This would build and run only the
Manual Tests
as compared to running all tests with commandbuild src\System.Data.SqlClient -debug /p:ForceRunTests=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you combine then you get test infrastructure failures:
Running the specific build you want to test one at a time works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is my console output for the command
dotnet msbuild .\src\System.Data.SqlClient\tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj /t:RebuildAndTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will get the same thing if I use msbuild in the directory or build with either release or debug. If I run an allconfigurations build with force run tests 4 of the error I showed above occur as it tries to run the tests for configurations that don't work.
So allconfigurations with tests doesn't work, a single config does. Since it's just supposed to get people started I wanted to break the build and test steps out individually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So running the above command will only build and test on platform based on the RID picked up automatically, which is
netcoreapp-Windows_NT-Debug-x64
in the case above.allconfigurations
will not work, since this is not building all configurations. The thing is thatbuild src\System.Data.SqlClient
chooses thecsproj
in the foldersrc\System.Data.SqlClient
which means it is running all the other tests inSqlClient
along with the manual tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tweaked it a bit. See if that's better. I also recently found you don't need to use msbuild to run a specific test, you can do it straight from build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two potential issues:
build src\System.Data.SqlClient -allconfigurations
builds all the tests and SqlClient and not just manual tests.build.cmd
implicitly, whereas on unix it will not pickupbuild.sh
implicitly.The suggested command
dotnet msbuild
will work across all platforms and will build only manual tests as per thecsproj
path specified.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it does. I was also crediting linux users with enough intelligence to realise that the shell script needed to be executable if they're trying to do development work. I've changed it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, changes look better, you can get rid of the Step 1, since Step 4 is taking care of building the Manual Tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.