Skip to content

Conversation

benrr101
Copy link
Contributor

Description

Re-enables DataStreamTests.RunAllTestsForSingleServer_TCP previously blocked by #5540

In Release mode, it works just fine without any changes. In Debug mode, though, it has issues with async behavior. The test harness for async test created (but did not start) an async operation, attempted to run the operation in parallel (which should fail as another async operation is in progress), then disposes the test harness and waits on the first async task. This fails because the connection is closed when the test harness is disposed, failing the test. It's unclear to me why the test harness disposes the connection or why it exists at all, but that's not the point. So, to resolve those issues, I followed a pattern used in another part of the test code that asserts the final wait throws. Totally unnecessary imho, but if we have to wait something that'll throw, then we might as well make sure it throws.

Another issue happens deep in the TdsParserStateObject in Debug mode. There is a Debug.Assert in there that validates the previousTimeoutState is Stopped. This check is failing in the test scenarios. However, immediately following the assert, we have an if statement that checks the exact same thing. Theoretically if the assert is correct, we always run the code in the if statement. But, since we have the conditional, we must expect that the asserted condition might not be met. It implies to me that the assert shouldn't exist. So I removed it and the test now passes.

Since this is a lengthy explanation, I figure I should submit this PR by itself.

Issues

#5540 - which I don't think exists in GH.

Testing

Running the test locally, it passes

benrr101 added 2 commits July 16, 2025 16:03
…ocked by #5540

Most of the issues with it were debug-only tests that checked async behavior. Async read task was expected to throw, but was simply being waited, causing the test to fail. Fixed by replacing waits with checks for exception (as was used in a handful of similar tests).

One issue was due to a debug assert failing in the TDS state object. It's really buried in timeout code, so I have no idea what it's expected to do. However, the code immediately after it was flagged by my IDE as always being true due to the debug - why are we conditionally executing code if we expect it to always be a certain value? So, I removed the debug assert.

Also added a handful of todo notes to the test class because it needs breaking up. And it's full of smelly Thread.Wait code.
@benrr101 benrr101 added this to the 7.0-preview1 milestone Jul 21, 2025
@Copilot Copilot AI review requested due to automatic review settings July 21, 2025 17:37
@benrr101 benrr101 added the Area\Tests Issues that are targeted to tests or test projects label Jul 21, 2025
@benrr101 benrr101 requested a review from a team as a code owner July 21, 2025 17:37
Copy link
Contributor

@Copilot 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

This PR re-enables the DataStreamTests.RunAllTestsForSingleServer_TCP test that was previously disabled due to issue #5540. The changes address async operation handling issues in Debug mode and resolve test stability problems.

Key changes include:

  • Removing the [ActiveIssue("5540")] attribute to re-enable the disabled test
  • Updating async task waiting patterns to properly handle expected exceptions
  • Removing a problematic Debug.Assert that was causing failures in test scenarios
  • Removing an entire test file that appears to be no longer needed

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
DataStreamTest.cs Re-enables TCP test, updates async exception handling patterns, removes failing test method
AsyncTest.cs Complete file deletion of async performance test
Microsoft.Data.SqlClient.ManualTesting.Tests.csproj Removes reference to deleted AsyncTest.cs file
TdsParserStateObject.cs Removes Debug.Assert that was failing in test scenarios
Comments suppressed due to low confidence (1)

paulmedynski
paulmedynski previously approved these changes Jul 22, 2025
mdaigle
mdaigle previously approved these changes Jul 23, 2025
@paulmedynski
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@paulmedynski paulmedynski dismissed stale reviews from mdaigle and themself via a6a257f August 22, 2025 19:07
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.51%. Comparing base (8eb9f32) to head (0d41c88).
⚠️ Report is 50 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3494      +/-   ##
==========================================
- Coverage   68.86%   64.51%   -4.36%     
==========================================
  Files         280      276       -4     
  Lines       62417    62582     +165     
==========================================
- Hits        42982    40372    -2610     
- Misses      19435    22210    +2775     
Flag Coverage Δ
addons 90.82% <ø> (-1.76%) ⬇️
netcore 66.79% <ø> (-5.96%) ⬇️
netfx 68.04% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmedynski paulmedynski requested a review from mdaigle August 27, 2025 15:39
@paulmedynski paulmedynski requested a review from mdaigle August 27, 2025 17:46
@paulmedynski paulmedynski merged commit dc8f23b into main Aug 27, 2025
250 checks passed
@paulmedynski paulmedynski deleted the dev/russellben/active-issues-1 branch August 27, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area\Tests Issues that are targeted to tests or test projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants