-
Notifications
You must be signed in to change notification settings - Fork 4.9k
SqlClient Manual Test fixes and documentation update #34546
Conversation
remove UTFSupportedTest test
update manual test readme with more detail on running them fix minor code oops
Test failure is unrelated and to do with the even log assembly, lets retry anyway. |
@Wraith2 This test was added as part of #30917: Support for UTF8 Feature Extension.
Which means that if |
As a standalone test it has no function. I'm testing against 2017 which doesn't have support and it just tells me that UTF8 isn't supported but that is neither a failure or a success it's simply a fact. Why tell me a fact each time I run it? it adds nothing useful and distracts from possible important data. If UTF8 support were required then using it as a guard condition makes sense and you'll see the test being skipped in the output but at the moment there are no tests which use uft8 facilities and as such it serves no useful purpose. As you can see I didn't remove the logic I just changed it to be a guard function so when you do add utf8 specific tests it's easily available. |
While I agree that it states a fact when SQL Server doesn't support UTF-8, however I beg to differ that it has no function, as explained above it tells you if the UTF-8 support is setup correctly on client-side when the server supports UTF-8. Why don't we break up the test into a guard function and use that guard function to determine if to skip or run the test, this should alleviate your concerns regarding the console output as well. Guard Function: public static bool IsUTF8Supported()
{
bool retval = false;
if (AreConnStringsSetup())
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
using (SqlCommand command = new SqlCommand())
{
command.Connection = connection;
command.CommandText = "SELECT CONNECTIONPROPERTY('SUPPORT_UTF8')";
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
// CONNECTIONPROPERTY('SUPPORT_UTF8') returns NULL in SQLServer versions that don't support UTF-8.
retval = !reader.IsDBNull(0);
}
}
}
}
return retval;
} Unit Test (Uses the Guard Function):public static class Utf8SupportTest
{
[ConditionalFact(typeof(DataTestUtility),nameof(DataTestUtility.AreConnStringsSetup),nameof(DataTestUtility.IsUTF8Supported))]
public static void CheckSupportUtf8ConnectionProperty()
{
using (SqlConnection connection = new SqlConnection(DataTestUtility.TcpConnStr))
using (SqlCommand command = new SqlCommand())
{
command.Connection = connection;
command.CommandText = "SELECT CONNECTIONPROPERTY('SUPPORT_UTF8')";
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
Assert.Equal(1, reader.GetInt32(0));
}
}
}
} |
## Running All Tests | ||
|
||
1. run `build src\System.Data.SqlClient -allconfigurations` and make sure the builds all work |
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 command build 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:
Executing in E:\Programming\csharp7\corefx\artifacts\bin\tests\System.Data.SqlClient.Tests\netcoreapp-Windows_NT-Debug-x64\
----- start 22:39:13.28 =============== To repro directly: =====================================================
pushd E:\Programming\csharp7\corefx\artifacts\bin\tests\System.Data.SqlClient.Tests\netcoreapp-Windows_NT-Debug-x64\
popd
===========================================================================================================
A JSON parsing exception occurred in [E:\Programming\csharp7\corefx\artifacts\bin\tests\System.Data.SqlClient.Tests\netcoreapp-Windows_NT-Debug-x64\xunit.console.runtimeconfig.json]: * Line 1, Column 2 Syntax error: Malformed token
Invalid runtimeconfig.json [E:\Programming\csharp7\corefx\artifacts\bin\tests\System.Data.SqlClient.Tests\netcoreapp-Windows_NT-Debug-x64\xunit.console.runtimeconfig.json] [E:\Programming\csharp7\corefx\artifacts\bin\tests\System.Data.SqlClient.Tests\netcoreapp-Windows_NT-Debug-x64\xunit.console.runtimeconfig.dev.json]
----- end 22:39:13.31 ----- exit code -2147450733 ----------------------------------------------------------
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
PS D:\dotNetCore\corefx> dotnet msbuild .\src\System.Data.SqlClient\tests\ManualTests\System.Data.SqlClient.ManualTesting.Tests.csproj /t:RebuildAndTest
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Address -> D:\dotNetCore\corefx\artifacts\bin\Address\netstandard-AnyOS-Debug\Address.dll
Utf8String -> D:\dotNetCore\corefx\artifacts\bin\Utf8String\netstandard-AnyOS-Debug\Utf8String.dll
Shapes -> D:\dotNetCore\corefx\artifacts\bin\Shapes\netstandard-AnyOS-Debug\Shapes.dll
Circle -> D:\dotNetCore\corefx\artifacts\bin\Circle\netstandard-AnyOS-Debug\Circle.dll
System.Data.SqlClient.ManualTesting.Tests -> D:\dotNetCore\corefx\artifacts\bin\System.Data.SqlClient.ManualTesting.Tests\netcoreapp-AnyOS-Debug\System.Data.SqlClient.ManualTesting.Tests.dll
Using D:\dotNetCore\corefx\artifacts\bin\testhost\netcoreapp-Windows_NT-Debug-x64 as the test runtime folder.
Executing in D:\dotNetCore\corefx\artifacts\bin\tests\System.Data.SqlClient.ManualTesting.Tests\netcoreapp-Windows_NT-Debug-x64\
----- start 15:13:58.80 =============== To repro directly: =====================================================
pushd D:\dotNetCore\corefx\artifacts\bin\tests\System.Data.SqlClient.ManualTesting.Tests\netcoreapp-Windows_NT-Debug-x64\
D:\dotNetCore\corefx\artifacts\bin\testhost\netcoreapp-Windows_NT-Debug-x64\dotnet.exe xunit.console.dll System.Data.SqlClient.ManualTesting.Tests.dll -xml testResults.xml -nologo -notrait category=nonnetcoreapptests -notrait category=nonwindowstests -notrait category=failing -notrait category=Outerloop
popd
===========================================================================================================
Discovering: System.Data.SqlClient.ManualTesting.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Data.SqlClient.ManualTesting.Tests (found 206 test cases)
Starting: System.Data.SqlClient.ManualTesting.Tests (parallel test collections = on, max threads = 8)
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 that build src\System.Data.SqlClient
chooses the csproj
in the folder src\System.Data.SqlClient
which means it is running all the other tests in SqlClient
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:
- Using
build src\System.Data.SqlClient -allconfigurations
builds all the tests and SqlClient and not just manual tests. - Kindly confirm this, as per my understanding build might not on unix, as on windows, the build command picks up
build.cmd
implicitly, whereas on unix it will not pickupbuild.sh
implicitly.
The suggested commanddotnet 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.
Agreed, and done. |
@dotnet-bot |
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.
Code changes look good to me, except the last requested change in the README
file.
I'll let @afsanehr @saurabh500 have the final say on the approval.
@dotnet-bot test corefx-ci |
1 similar comment
@dotnet-bot test corefx-ci |
synced and pushed to re-trigger |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
The failures are all sending to helix, which wouldn't run the manual tests that were changed or care about the readme. |
Merging this PR as the CI failures are not related to the changes made with this PR. Thanks @Wraith2 |
SqlClient Manual Test fixes and documentation update Commit migrated from dotnet/corefx@f749fca
Fixes
CodeCoverageSqlClient
after SyncRoot changes in #34198Adds the UdtTestDatabase creation script.
Removes
Utf8SupportTest
and replaced it with aDataTestUtility.IsUTF8Supported
function. The test wasn't doing anything useful and makes the console output look strange, it looked like it was the prereq to a bunch of utf8 specific test functionality.Adds extra conditions to tests affected by https://github.com/dotnet/corefx/issues/33930 so they they will be skipped if managed SNI is being used. The accepted way to do this would be to add
[ActiveIssue(33930)]
but that would disable the tests for the native implementation and they're still functional there. Instead I chose to add a new condition function inDataTestUtility.IsUsingNativeSNI
and use that condition to skip the tests in managed mode. Each location that this condition function is used has a comment containing the text of the active issue attribute that would normally have been applied so that searching will find them when we fix the bug.Updates the manual tests readme with more information and itemisation.
/cc all the usual suspects, @afsanehr @keeratsingh @saurabh500