Skip to content

Commit dc8f23b

Browse files
Tests | Active Issues 1 (#3494)
* Remove AsyncTest * Reenable DataStreamTest.RunAllTestsForSingleServer_TCP, previously blocked 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. * Inhibited tests that fail on Azure or Named Instances. * Inhibited more tests that fail on Azure or Named Instances. * Fixed test sensitive to row result ordering, and missing completeness checks. * - Added asserts to boolean function calls. - Updated loop to read XML results correctly. * Fixed inaccurate test. * GetUniqueNameForSqlServer() now includes the generated name in the exception if > 128 chars. * Truncating generated server name if necessary, rather than failing the test. * Fixed truncation to preserve closing ']' if present. --------- Co-authored-by: Paul Medynski <[email protected]>
1 parent 4e93076 commit dc8f23b

File tree

5 files changed

+63
-180
lines changed

5 files changed

+63
-180
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ internal void ReadSni(TaskCompletionSource<object> completion)
31513151
// the identity source. The identity value is used to correlate timer callback events to the currently
31523152
// running timeout and prevents a late timer callback affecting a result it does not relate to
31533153
int previousTimeoutState = Interlocked.CompareExchange(ref _timeoutState, TimeoutState.Running, TimeoutState.Stopped);
3154-
Debug.Assert(previousTimeoutState == TimeoutState.Stopped, "previous timeout state was not Stopped");
3154+
31553155
if (previousTimeoutState == TimeoutState.Stopped)
31563156
{
31573157
Debug.Assert(_timeoutIdentityValue == 0, "timer was previously stopped without resetting the _identityValue");

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,21 @@ public static string GetUniqueNameForSqlServer(string prefix, bool withBracket =
595595
Environment.MachineName,
596596
DateTime.Now.ToString("yyyy_MM_dd", CultureInfo.InvariantCulture));
597597
string name = GetUniqueName(extendedPrefix, withBracket);
598-
if (name.Length > 128)
598+
599+
// Truncate to no more than 128 characters.
600+
const int maxLen = 128;
601+
if (name.Length > maxLen)
599602
{
600-
throw new ArgumentOutOfRangeException("the name is too long - SQL Server names are limited to 128");
603+
if (withBracket)
604+
{
605+
name = name.Substring(0, maxLen - 1) + ']';
606+
}
607+
else
608+
{
609+
name = name.Substring(0, maxLen);
610+
}
601611
}
612+
602613
return name;
603614
}
604615

src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
<Compile Include="SQL\AsyncTest\BeginExecAsyncTest.cs" />
8080
<Compile Include="SQL\AsyncTest\BeginExecReaderAsyncTest.cs" />
8181
<Compile Include="SQL\AsyncTest\XmlReaderAsyncTest.cs" />
82-
<Compile Include="SQL\AsyncTest\AsyncTest.cs" />
8382
<Compile Include="SQL\AsyncTest\AsyncCancelledConnectionsTest.cs" />
8483
</ItemGroup>
8584
<ItemGroup Condition="'$(TestSet)' == '' OR '$(TestSet)' == '2'">

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)