From ae09fccc6f8024119fc93feb32ac1ae8286c25d5 Mon Sep 17 00:00:00 2001
From: Paul Medynski <31868385+paulmedynski@users.noreply.github.com>
Date: Wed, 8 Jan 2025 16:13:38 -0400
Subject: [PATCH 1/7] User Story 33279: Fix xUnit Theory serialization warnings
- Suppressed xUnit discovery data enumeration warnings in Function and Manual test projects.
- Fixed xUnit test data enumeration warnings specific to .NET Framework (enums in the GAC).
- Added targets to run Windows and Unix tests.
- Cleaned up test run command lines for improved maintenance and runtime logging.
---
build.proj | 108 +++++++++-
...ncryptionCertificateStoreProviderShould.cs | 50 +++--
.../AmbientTransactionFailureTest.cs | 8 +-
.../FunctionalTests/SqlClientFactoryTest.cs | 7 +-
.../FunctionalTests/SqlCommandSetTest.cs | 22 +-
.../FunctionalTests/SqlDataRecordTest.cs | 45 ++--
.../tests/FunctionalTests/SqlMetaDataTest.cs | 188 +++++++++++++----
.../tests/FunctionalTests/SqlParameterTest.cs | 198 ++++++++++++------
.../ManualTests/AlwaysEncrypted/ApiShould.cs | 44 +++-
.../AlwaysEncrypted/ConversionTests.cs | 61 ++++--
.../TestFixtures/DatabaseHelper.cs | 43 ++--
.../CertificateTestWithTdsServer.cs | 13 +-
.../DataReaderTest/DataReaderStreamsTest.cs | 88 ++++++--
.../SQL/JsonTest/JsonBulkCopyTest.cs | 38 ++--
.../config.default.json | 10 +-
15 files changed, 680 insertions(+), 243 deletions(-)
diff --git a/build.proj b/build.proj
index 95b7ac947d..c470970f03 100644
--- a/build.proj
+++ b/build.proj
@@ -178,21 +178,109 @@
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+ $(DotnetPath)dotnet test "@(FunctionalTestsProj)"
+ --no-build
+ -v n
+ -p:Configuration=$(Configuration)
+ -p:Target$(TFGroup)Version=$(TF)
+ -p:ReferenceType=$(ReferenceType)
+ -p:TestSet=$(TestSet)
+ -p:TestTargetOS=Windows$(TargetGroup)
+ --collect "Code coverage"
+ --results-directory $(ResultsDirectory)
+ --filter "category!=non$(TargetGroup)tests&category!=failing&category!=nonwindowstests"
+ --logger:"trx;LogFilePrefix=Functional-Windows$(TargetGroup)-$(TestSet)"
+
+ $(TestCommand.Replace($([System.Environment]::NewLine), " "))
+
+
+
+
+
+
+
+
+
+ $(DotnetPath)dotnet test "@(FunctionalTestsProj)"
+ --no-build
+ -v n
+ -p:Configuration=$(Configuration)
+ -p:TargetNetCoreVersion=$(TF)
+ -p:ReferenceType=$(ReferenceType)
+ -p:TestSet=$(TestSet)
+ -p:TestTargetOS=Unixnetcoreapp
+ --collect "Code coverage"
+ --results-directory $(ResultsDirectory)
+ --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
+ --logger:"trx;LogFilePrefix=Functional-Unixnetcoreapp-$(TestSet)"
+
+ $(TestCommand.Replace($([System.Environment]::NewLine), " "))
+
+
+
+
+
+
+
+
+
+
+
+
+ $(DotnetPath)dotnet test "@(ManualTestsProj)"
+ --no-build
+ -v n
+ -p:Configuration=$(Configuration)
+ -p:Target$(TFGroup)Version=$(TF)
+ -p:ReferenceType=$(ReferenceType)
+ -p:TestSet=$(TestSet)
+ -p:TestTargetOS=Windows$(TargetGroup)
+ --collect "Code coverage"
+ --results-directory $(ResultsDirectory)
+ --filter "category!=non$(TargetGroup)tests&category!=failing&category!=nonwindowstests"
+ --logger:"trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)"
+
+ $(TestCommand.Replace($([System.Environment]::NewLine), " "))
+
+
+
-
-
-
-
-
+
+
+
+
+ $(DotnetPath)dotnet test "@(ManualTestsProj)"
+ --no-build
+ -v n
+ -p:Configuration=$(Configuration)
+ -p:TargetNetCoreVersion=$(TF)
+ -p:ReferenceType=$(ReferenceType)
+ -p:TestSet=$(TestSet)
+ -p:TestTargetOS=Unixnetcoreapp
+ --collect "Code coverage"
+ --results-directory $(ResultsDirectory)
+ --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
+ --logger:"trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)"
+
+ $(TestCommand.Replace($([System.Environment]::NewLine), " "))
+
+
+
+
diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
index 3a220cd9c7..216afef784 100644
--- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
+++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/SqlColumnEncryptionCertificateStoreProviderShould.cs
@@ -230,7 +230,16 @@ public void EncryptAndDecryptDataSuccessfully()
}
[Theory]
- [CEKEncryptionReversalParameters]
+ [MemberData(
+ nameof(CEKEncryptionReversalData)
+#if NETFRAMEWORK
+ // .NET Framework puts system enums in something called the Global
+ // Assembly Cache (GAC), and xUnit refuses to serialize enums that
+ // live there. So for .NET Framework, we disable enumeration of the
+ // test data to avoid warnings on the console when running tests.
+ , DisableDiscoveryEnumeration = true
+#endif
+ )]
[PlatformSpecific(TestPlatforms.Windows)]
public void TestCEKEncryptionReversal(StoreLocation certificateStoreLocation, String certificateStoreNameAndLocation)
{
@@ -381,8 +390,13 @@ public void TestCustomKeyProviderListSetter()
}
[Theory]
+ [MemberData(
+ nameof(ValidCertificatePathsData)
+#if NETFRAMEWORK
+ , DisableDiscoveryEnumeration = true
+#endif
+ )]
[PlatformSpecific(TestPlatforms.Windows)]
- [ValidCertificatePathsParameters]
public void TestValidCertificatePaths(string certificateStoreNameAndLocation, object location)
{
StoreLocation certificateStoreLocation;
@@ -505,33 +519,25 @@ public override IEnumerable