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

Tests | Activate "ActiveIssue" tests #3012

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
aef7d06
Use Assert.Throws instead of home-grown
MichelZ Nov 18, 2024
d14975e
TestConnectionStateWithErrorClass20 on NET8 fails on Debug build with…
MichelZ Nov 18, 2024
0cd7a63
Activate SqlExceptionTest, they seem to work fine now on Linux
MichelZ Nov 18, 2024
86bcc0c
Activate WeakRefTestYukonSpecific, it runs fine on Linux
MichelZ Nov 18, 2024
6f3f107
Activate IntegratedAuthenticationTest, it runs fine
MichelZ Nov 18, 2024
d614b58
Activate LocalDBTest, make sure Local DB is present. They run fine
MichelZ Nov 18, 2024
c810732
Activate reliability tests, they run fine
MichelZ Nov 18, 2024
8ca44b9
Activate Credential Tests, they seem to work fine
MichelZ Nov 18, 2024
f854d0e
Activate CommandCancel tests, add Conditions to existing issue
MichelZ Nov 18, 2024
241a241
Activate Udt tests, they seem to work fine
MichelZ Nov 18, 2024
f1765a2
Activate PacketNumberWraparound test, it works fine
MichelZ Nov 18, 2024
a0844a8
Improve certificate tests by checking IsAdmin outside the constructor
MichelZ Nov 18, 2024
8a83e20
- Remove AsyncTest (why would Async be faster than Sync?)
MichelZ Nov 18, 2024
4c0448b
Fix spelling
MichelZ Nov 18, 2024
8b9a806
Fix grammatical errors
MichelZ Nov 18, 2024
8fb9d0b
Revert unintended change
MichelZ Nov 18, 2024
968a33c
Merge branch 'pr/enable-activeissue-tests' of https://github.com/Mich…
MichelZ Nov 18, 2024
55f88dd
Use Close instead of Dispose, as Dispose swallows the exception
MichelZ Nov 24, 2024
1abcedb
Remove comment about IPv6 & Cert as this now works in NET8+
MichelZ Nov 24, 2024
e4c7165
Do not run XEvent test on azure
MichelZ Nov 24, 2024
3317cbc
The rest of the tests run fine on Azure
MichelZ Nov 24, 2024
4a4f407
Fix azure check
MichelZ Nov 24, 2024
86eb7aa
Disable more tests for Azure
MichelZ Nov 25, 2024
8e3af02
Also disable named instances
MichelZ Nov 25, 2024
fcce097
Remove ExectueXmlReaderTest on ARM
MichelZ Nov 25, 2024
968e884
Disable tests with proxy for azure
MichelZ Nov 25, 2024
7dae71a
Merge branch 'main' into pr/enable-activeissue-tests
MichelZ Nov 26, 2024
57d4a5e
Add data ordering to queries
MichelZ Nov 27, 2024
caf6a5b
Enable test on ARM
MichelZ Nov 27, 2024
c66230c
Remove whitespace
MichelZ Nov 27, 2024
b4d1a79
Formatting
MichelZ Nov 27, 2024
6aa1dc7
Merge branch 'main' into pr/enable-activeissue-tests
MichelZ Nov 27, 2024
1034f92
Restore newline
MichelZ Dec 3, 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
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private enum Keywords
private bool _transparentNetworkIPResolution = DbConnectionStringDefaults.TransparentNetworkIPResolution;
private string _networkLibrary = DbConnectionStringDefaults.NetworkLibrary;
#else
internal const int DeprecatedKeywordsCount = 5;
internal const int DeprecatedKeywordsCount = 4;
MichelZ marked this conversation as resolved.
Show resolved Hide resolved
#endif
#endregion //Fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class SqlExceptionTest
private const string badServer = "92B96911A0BD43E8ADA4451031F7E7CF";

[Fact]
[ActiveIssue("12161", TestPlatforms.AnyUnix)]
public void SerializationTest()
{
SqlException e = CreateException();
Expand All @@ -26,7 +25,6 @@ public void SerializationTest()
TypeNameHandling = TypeNameHandling.All,
};

// TODO: Deserialization fails on Unix with "Member 'ClassName' was not found."
var sqlEx = JsonConvert.DeserializeObject<SqlException>(json, settings);

Assert.Equal(e.ClientConnectionId, sqlEx.ClientConnectionId);
Expand All @@ -35,7 +33,6 @@ public void SerializationTest()

#if NETFRAMEWORK
[Fact]
[ActiveIssue("12161", TestPlatforms.AnyUnix)]
public static void SqlExcpetionSerializationTest()
MichelZ marked this conversation as resolved.
Show resolved Hide resolved
{
var formatter = new BinaryFormatter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
[PlatformSpecific(TestPlatforms.Windows)]
public class CspProviderExt
{
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE))]
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAdmin))]
[ClassData(typeof(AEConnectionStringProvider))]
public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders(string connectionString)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static class DataTestUtility
//SQL Server EngineEdition
private static string s_sqlServerEngineEdition;

// JSON Coloumn type
// JSON Column type
public static readonly bool IsJsonSupported = false;

// Azure Synapse EngineEditionId == 6
Expand All @@ -107,8 +107,8 @@ public static bool IsAzureSynapse
{
s_sqlServerEngineEdition ??= GetSqlServerProperty(TCPConnectionString, "EngineEdition");
}
_ = int.TryParse(s_sqlServerEngineEdition, out int engineEditon);
return engineEditon == 6;
_ = int.TryParse(s_sqlServerEngineEdition, out int engineEdition);
return engineEdition == 6;
}
}

Expand Down Expand Up @@ -455,6 +455,11 @@ public static bool IsNotAzureServer()
return !AreConnStringsSetup() || !Utils.IsAzureSqlServer(new SqlConnectionStringBuilder((TCPConnectionString)).DataSource);
}

public static bool IsNotNamedInstance()
{
return !AreConnStringsSetup() || !new SqlConnectionStringBuilder(TCPConnectionString).DataSource.Contains(@"\");
}

// Synapse: Always Encrypted is not supported with Azure Synapse.
// Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/17858869-support-always-encrypted-in-sql-data-warehouse
public static bool IsAKVSetupAvailable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,12 @@
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup Condition="'$(TestSet)' == '' or '$(TestSet)' == 'AE'">
<Compile Include="AlwaysEncrypted\CoreCryptoTests.cs" />
<Compile Include="AlwaysEncrypted\ConversionTests.cs" />
<Compile Include="AlwaysEncrypted\ExceptionsGenericError.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CryptoVector.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CryptoNativeBaselineReader.cs" />
<Compile Include="AlwaysEncrypted\TestTrustedMasterKeyPaths.cs" />
<Content Include="AlwaysEncrypted\TestFixtures\Setup\TCECryptoNativeBaseline.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>TCECryptoNativeBaseline.txt</Link>
</Content>
<Content Include="AlwaysEncrypted\TestFixtures\Setup\TCECryptoNativeBaselineRsa.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>TCECryptoNativeBaselineRsa.txt</Link>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(TargetsWindows)' == 'true' AND ('$(TestSet)' == '' OR '$(TestSet)' == 'AE')">
<Compile Include="AlwaysEncrypted\CspProviderExt.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CertificateUtilityWin.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CspProviderColumnMasterKey.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\SQLSetupStrategyCspExt.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TestSet)' == '' OR '$(TestSet)' == 'AE'">
<Compile Include="AlwaysEncrypted\AKVTests.cs" />
<Compile Include="AlwaysEncrypted\AKVUnitTests.cs" />
<Compile Include="AlwaysEncrypted\CoreCryptoTests.cs" />
<Compile Include="AlwaysEncrypted\ConversionTests.cs" />
<Compile Include="AlwaysEncrypted\EnclaveAzureDatabaseTests.cs" />
<Compile Include="AlwaysEncrypted\ExceptionsGenericError.cs" />
<Compile Include="AlwaysEncrypted\ExceptionTestAKVStore.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\AKVTestTable.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\AkvColumnMasterKey.cs" />
Expand All @@ -59,6 +40,8 @@
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\BulkCopyAEErrorMessageTestTable.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\BulkCopyTruncationTables.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\ColumnDecryptErrorTestTable.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CryptoVector.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CryptoNativeBaselineReader.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\DateOnlyTestTable.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\SqlNullValuesTable.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\SqlParameterPropertiesTable.cs" />
Expand All @@ -72,6 +55,21 @@
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\DummyKeyStoreProvider.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\DummyProviderMasterKey.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CertificateUtility.cs" />
<Content Include="AlwaysEncrypted\TestFixtures\Setup\TCECryptoNativeBaseline.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>TCECryptoNativeBaseline.txt</Link>
</Content>
<Content Include="AlwaysEncrypted\TestFixtures\Setup\TCECryptoNativeBaselineRsa.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>TCECryptoNativeBaselineRsa.txt</Link>
</Content>
<Compile Include="AlwaysEncrypted\TestTrustedMasterKeyPaths.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsWindows)' == 'true' AND ('$(TestSet)' == '' OR '$(TestSet)' == 'AE')">
MichelZ marked this conversation as resolved.
Show resolved Hide resolved
<Compile Include="AlwaysEncrypted\CspProviderExt.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CertificateUtilityWin.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\Setup\CspProviderColumnMasterKey.cs" />
<Compile Include="AlwaysEncrypted\TestFixtures\SQLSetupStrategyCspExt.cs" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) AND ('$(TestSet)' == '' OR '$(TestSet)' == 'AE')">
<Compile Include="AlwaysEncrypted\DateOnlyReadTests.cs" />
Expand All @@ -81,7 +79,6 @@
<Compile Include="SQL\AsyncTest\BeginExecAsyncTest.cs" />
<Compile Include="SQL\AsyncTest\BeginExecReaderAsyncTest.cs" />
<Compile Include="SQL\AsyncTest\XmlReaderAsyncTest.cs" />
<Compile Include="SQL\AsyncTest\AsyncTest.cs" />
<Compile Include="SQL\AsyncTest\AsyncCancelledConnectionsTest.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TestSet)' == '' OR '$(TestSet)' == '2'">
Expand Down Expand Up @@ -175,15 +172,21 @@
<Compile Include="DDBasics\DDAsyncTest\DDAsyncTest.cs" />
<Compile Include="DDBasics\DDDataTypesTest\DDDataTypesTest.cs" />
<Compile Include="DDBasics\DDMARSTest\DDMARSTest.cs" />
<Compile Include="Json\SqlJsonTest.cs" />
<Compile Include="ProviderAgnostic\MultipleResultsTest\MultipleResultsTest.cs" />
<Compile Include="ProviderAgnostic\ReaderTest\ReaderTest.cs" />
<Compile Include="TracingTests\EventSourceTest.cs" />
<Compile Include="SQL\AADFedAuthTokenRefreshTest\AADFedAuthTokenRefreshTest.cs" />
<Compile Include="SQL\ConnectionTestWithSSLCert\CertificateTest.cs" />
<Compile Include="SQL\ConnectionTestWithSSLCert\CertificateTestWithTdsServer.cs" />
<Compile Include="SQL\ConnectionPoolTest\ConnectionPoolTest.cs" />
<Compile Include="SQL\ConnectionPoolTest\PoolBlockPeriodTest.cs" />
<Compile Include="SQL\DataSourceParserTest\DataSourceParserTest.cs" />
<Compile Include="SQL\InstanceNameTest\InstanceNameTest.cs" />
<Compile Include="SQL\IntegratedAuthenticationTest\IntegratedAuthenticationTest.cs" />
<Compile Include="SQL\JsonTest\JsonBulkCopyTest.cs" />
<Compile Include="SQL\JsonTest\JsonStreamTest.cs" />
<Compile Include="SQL\JsonTest\JsonTest.cs" />
<Compile Include="SQL\KerberosTests\KerberosTest.cs" />
<Compile Include="SQL\KerberosTests\KerberosTicketManager\KerberosTicketManager.cs" />
<Compile Include="SQL\LocalDBTest\LocalDBTest.cs" />
Expand All @@ -195,6 +198,7 @@
<Compile Include="SQL\SqlCommand\SqlCommandCompletedTest.cs" />
<Compile Include="SQL\SqlCommand\SqlCommandCancelTest.cs" />
<Compile Include="SQL\SqlCommand\SqlCommandSetTest.cs" />
<Compile Include="SQL\SqlCommand\SqlCommandStoredProcTest.cs" />
<Compile Include="SQL\SqlCredentialTest\SqlCredentialTest.cs" />
<Compile Include="SQL\SqlDependencyTest\SqlDependencyTest.cs" />
<Compile Include="SQL\SqlFileStreamTest\SqlFileStreamTest.cs" />
Expand Down Expand Up @@ -280,7 +284,6 @@
<Compile Include="DataCommon\ProxyServer.cs" />
<Compile Include="DataCommon\SqlClientCustomTokenCredential.cs" />
<Compile Include="DataCommon\SystemDataResourceManager.cs" />
<Compile Include="Json\SqlJsonTest.cs" />
<Compile Include="SQL\Common\AsyncDebugScope.cs" />
<Compile Include="SQL\Common\ConnectionPoolWrapper.cs" />
<Compile Include="SQL\Common\InternalConnectionWrapper.cs" />
Expand All @@ -292,12 +295,6 @@
<Compile Include="SQL\Common\SystemDataInternals\FedAuthTokenHelper.cs" />
<Compile Include="SQL\Common\SystemDataInternals\TdsParserHelper.cs" />
<Compile Include="SQL\Common\SystemDataInternals\TdsParserStateObjectHelper.cs" />
<Compile Include="SQL\ConnectionTestWithSSLCert\CertificateTest.cs" />
<Compile Include="SQL\ConnectionTestWithSSLCert\CertificateTestWithTdsServer.cs" />
<Compile Include="SQL\JsonTest\JsonBulkCopyTest.cs" />
<Compile Include="SQL\JsonTest\JsonStreamTest.cs" />
<Compile Include="SQL\JsonTest\JsonTest.cs" />
<Compile Include="SQL\SqlCommand\SqlCommandStoredProcTest.cs" />
<Compile Include="TracingTests\TestTdsServer.cs" />
<Compile Include="XUnitAssemblyAttributes.cs" />
</ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
[PlatformSpecific(TestPlatforms.Windows)]
public class CertificateTest : IDisposable
{
#region Private Fields
Expand Down Expand Up @@ -75,10 +76,11 @@ public CertificateTest()
SlashInstanceName = $"\\{InstanceName}";
}

Assert.True(DataTestUtility.IsAdmin, "CertificateTest class needs to be run in Admin mode.");

CreateValidCertificate(s_fullPathToPowershellScript);
_thumbprint = Environment.GetEnvironmentVariable(ThumbPrintEnvName, EnvironmentVariableTarget.Machine);
if (IsAdmin())
{
CreateValidCertificate(s_fullPathToPowershellScript);
_thumbprint = Environment.GetEnvironmentVariable(ThumbPrintEnvName, EnvironmentVariableTarget.Machine);
}
}

private static bool IsLocalHost()
Expand All @@ -91,17 +93,16 @@ private static bool IsLocalHost()
private static bool AreConnStringsSetup() => DataTestUtility.AreConnStringsSetup();
private static bool IsNotAzureServer() => DataTestUtility.IsNotAzureServer();
private static bool UseManagedSNIOnWindows() => DataTestUtility.UseManagedSNIOnWindows;
private static bool IsAdmin() => DataTestUtility.IsAdmin;

[ActiveIssue("31754")]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost))]
[PlatformSpecific(TestPlatforms.Windows)]
public void OpenningConnectionWithGoodCertificateTest()
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))]
public void OpeningConnectionWithGoodCertificateTest()
{
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString);

// confirm that ForceEncryption is enabled
using SqlConnection notEncryptedConnection = new(builder.ConnectionString);
builder.Encrypt = SqlConnectionEncryptOption.Optional;
using SqlConnection notEncryptedConnection = new(builder.ConnectionString);
notEncryptedConnection.Open();
Assert.Equal(ConnectionState.Open, notEncryptedConnection.State);

Expand All @@ -122,9 +123,7 @@ public void OpenningConnectionWithGoodCertificateTest()

// Provided hostname in certificate are:
// localhost, FQDN, Loopback IPv4: 127.0.0.1, IPv6: ::1
[ActiveIssue("31754")]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost))]
[PlatformSpecific(TestPlatforms.Windows)]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))]
public void OpeningConnectionWitHNICTest()
{
// Mandatory
Expand All @@ -142,8 +141,8 @@ public void OpeningConnectionWitHNICTest()
connection.Open();
Assert.Equal(ConnectionState.Open, connection.State);

// Ipv6 however causes name mistmatch error
// In net6 Manged SNI does not check for SAN. Therefore Application using Net6 have to use FQDN as HNIC
// Ipv6 however causes name mismatch error
// In net6 Manged SNI does not check for SAN. Therefor Application using Net6 have to use FQDN as HNIC
// According to above no other hostname in certificate than FQDN will work in net6 which is same as SubjectName in case of RemoteCertificateNameMismatch
// Net7.0 the new API added by dotnet runtime will check SANS and then SubjectName
MichelZ marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -167,8 +166,7 @@ public void OpeningConnectionWitHNICTest()
}

[ActiveIssue("31754")]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(UseManagedSNIOnWindows), nameof(IsNotAzureServer), nameof(IsLocalHost))]
[PlatformSpecific(TestPlatforms.Windows)]
[ConditionalFact(nameof(AreConnStringsSetup), nameof(UseManagedSNIOnWindows), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))]
public void RemoteCertificateNameMismatchErrorTest()
{
SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString)
Expand Down
Loading
Loading