Skip to content

Conversation

@mdaigle
Copy link
Contributor

@mdaigle mdaigle commented Feb 12, 2026

Description

TvpTest is large an unmaintainable due to its "golden file" testing approach. We frequently see builds hang on these tests but have no way to diagnose because so much work happens under a single test case header (hundreds of individuals connections, queries, type comparisons, console logs, etc.). This PR kicks off the process of improving this test class.

The first order of business is breaking the test down into more manageable chunks. TvpTest.TestMain calls several helper test methods that can be split into their own classes and called directly as top-level tests. This requires splitting out the giant baseline files by test and updating the new tests to look only at their new targeted baseline file.

While splitting the baseline file, I ran TvpTest.TestMain on the concatenation of the split files to ensure that nothing was lost in the transition.

Testing

All test cases are preserved; this is just a refactor.

Copilot AI review requested due to automatic review settings February 12, 2026 18:41
@mdaigle mdaigle changed the title Test | Split TVPTest part1 Test | Split TvpTest part1 Feb 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the large TvpTest “golden file” manual test by splitting individual test groups into separate top-level test classes with their own baseline files, improving diagnosability and maintainability of the ManualTests suite.

Changes:

  • Removes the monolithic TvpTest.TestMain() runner and exposes specific helper methods/classes for reuse.
  • Adds new focused ManualTests (*Tests.cs) for QueryHints, ColumnBoundaries, StreamInputParameter, SqlVariantParameter, DateTimeVariant, and OutputParameter.
  • Splits the original baseline output into multiple per-test .bsl files and updates the ManualTests csproj content includes accordingly.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs Removes monolithic entrypoint and makes helpers accessible to new focused tests.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpQueryHintsTests.cs New top-level test for TVP query hints with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpColumnBoundariesTests.cs New top-level test for TVP column boundary permutations with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/StreamInputParameterTests.cs New top-level test for stream input parameter scenarios with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameterTests.cs New top-level test for SQL variant parameter scenarios with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/DateTimeVariantTests.cs New top-level test for DateTime variant scenarios with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/OutputParameterTests.cs New top-level test for output parameter scenarios with dedicated baseline comparison.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpQueryHints_DebugMode.bsl New split baseline for TVP query hints (Debug).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpQueryHints_DebugMode_Azure.bsl New split baseline for TVP query hints (Debug/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpQueryHints_ReleaseMode.bsl New split baseline for TVP query hints (Release).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpQueryHints_ReleaseMode_Azure.bsl New split baseline for TVP query hints (Release/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpColumnBoundaries_DebugMode.bsl New split baseline for TVP column boundaries (Debug).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpColumnBoundaries_DebugMode_Azure.bsl New split baseline for TVP column boundaries (Debug/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpColumnBoundaries_ReleaseMode.bsl New split baseline for TVP column boundaries (Release).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpColumnBoundaries_ReleaseMode_Azure.bsl New split baseline for TVP column boundaries (Release/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/StreamInputParameter_ReleaseMode.bsl New split baseline for stream input parameter test (Release).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/StreamInputParameter_ReleaseMode_Azure.bsl New split baseline for stream input parameter test (Release/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameter_DebugMode.bsl New split baseline for SQL variant parameter test (Debug).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameter_DebugMode_Azure.bsl New split baseline for SQL variant parameter test (Debug/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameter_ReleaseMode.bsl New split baseline for SQL variant parameter test (Release).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlVariantParameter_ReleaseMode_Azure.bsl New split baseline for SQL variant parameter test (Release/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/OutputParameter_DebugMode.bsl New split baseline for output parameter test (Debug).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/OutputParameter_DebugMode_Azure.bsl New split baseline for output parameter test (Debug/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/OutputParameter_ReleaseMode.bsl New split baseline for output parameter test (Release).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/OutputParameter_ReleaseMode_Azure.bsl New split baseline for output parameter test (Release/Azure).
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/DateTimeVariant_DebugMode.bsl Baseline updated to remove content moved into other split baselines.
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/DateTimeVariant_DebugMode_Azure.bsl Baseline updated to remove content moved into other split baselines.
src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj Adds new test files and new baseline content items; removes old monolithic baselines.

Comment on lines +25 to +30
[Trait("Category", "flaky")]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public void OutputParameterTest()
{
Assert.True(RunTestAndCompareWithBaseline());
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The original monolithic TvpTest.TestMain forced Thread.CurrentThread.CurrentCulture to en-US to keep date/time string output stable for baseline comparisons. After splitting, this test no longer sets culture, so baselines can become machine-locale dependent. Set the culture (and ideally restore the previous culture in a try/finally) before running the test logic.

Copilot uses AI. Check for mistakes.
Comment on lines 227 to 236
<Compile Include="SQL\UdtTest\UdtTest.cs" />
<Compile Include="SQL\UdtTest\UdtTest2.cs" />
<Compile Include="SQL\UdtTest\UdtTestHelpers.cs" />
<Compile Include="SQL\Utf8SupportTest\Utf8SupportTest.cs" />
<Compile Include="SQL\VectorTest\NativeVectorFloat32Tests.cs" />
<Compile Include="SQL\VectorTest\VectorAPIValidationTest.cs" />
<Compile Include="SQL\VectorTest\VectorTypeBackwardCompatibilityTests.cs" />
<Compile Include="SQL\WeakRefTest\WeakRefTest.cs" />
<Compile Include="SQL\WeakRefTestYukonSpecific\WeakRefTestYukonSpecific.cs" />
<Compile Include="TracingTests\DiagnosticTest.cs" />
<Compile Include="TracingTests\EventSourceTest.cs" />
<Compile Include="TracingTests\FakeDiagnosticListenerObserver.cs" />
<Compile Include="TracingTests\MetricsTest.cs" />
<Compile Include="TracingTests\XEventsTracingTest.cs" />

Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This change removes the TracingTests\*.cs files from the ManualTests project. Since EnableDefaultCompileItems is set to false in this csproj, those files will no longer be compiled or executed unless they are explicitly re-included. If this wasn't intentional (and it's not mentioned in the PR description), please add the Compile Include entries back (or re-enable default compile items).

Copilot uses AI. Check for mistakes.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

System.Collections.Generic is not used in this file. Since the repo builds with TreatWarningsAsErrors=true, this unnecessary using can fail the build (CS8019). Remove the unused using directive.

Suggested change
using System.Text;

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +31
[Trait("Category", "flaky")]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public void StreamInputParameterTest()
{
Assert.True(RunTestAndCompareWithBaseline());
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The original monolithic TvpTest.TestMain forced Thread.CurrentThread.CurrentCulture to en-US to keep date/time string output stable for baseline comparisons. After splitting, this test no longer sets culture, so baselines can become machine-locale dependent. Set the culture (and ideally restore the previous culture in a try/finally) before running the test logic.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +23
[Trait("Category", "flaky")]
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public void TvpColumnBoundariesTest()
{
Assert.True(RunTestAndCompareWithBaseline());
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The original monolithic TvpTest.TestMain forced Thread.CurrentThread.CurrentCulture to en-US to keep date/time string output stable for baseline comparisons. After splitting, this test no longer sets culture, so baselines can become machine-locale dependent. Set the culture (and ideally restore the previous culture in a try/finally) before running the test logic.

Copilot uses AI. Check for mistakes.
@mdaigle mdaigle marked this pull request as ready for review February 12, 2026 19:00
@mdaigle mdaigle requested a review from a team as a code owner February 12, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant