Skip to content

Commit 0e463e2

Browse files
github-actions[bot]Copilotcheenamalhotrapaulmedynski
authored
[6.1.5 Cherry-pick] Quarantine flaky tests (#4183)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com> Co-authored-by: Paul Medynski <31868385+paulmedynski@users.noreply.github.com>
1 parent 62a84c2 commit 0e463e2

12 files changed

Lines changed: 287 additions & 272 deletions

File tree

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

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

src/Microsoft.Data.SqlClient/tests/FunctionalTests/LocalizationTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class LocalizationTest
4040
[InlineData("ru-RU")]
4141
[InlineData("zh-Hans")]
4242
[InlineData("zh-Hant")]
43+
[Trait("Category", "flaky")]
4344
public void Localization_Tests(string culture)
4445
{
4546
string localized = GetLocalizedErrorMessage(culture);

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,17 @@ private static Task<string> AcquireTokenAsync(string authorityURL, string userID
293293

294294
/// <summary>
295295
/// Returns the current test name as:
296-
///
296+
///
297297
/// ClassName.MethodName
298-
///
298+
///
299299
/// xUnit v2 doesn't provide access to a test context, so we use
300300
/// reflection into the ITestOutputHelper to get the test name.
301301
/// </summary>
302-
///
302+
///
303303
/// <param name="outputHelper">
304304
/// The output helper instance for the currently running test.
305305
/// </param>
306-
///
306+
///
307307
/// <returns>The current test name.</returns>
308308
public static string CurrentTestName(ITestOutputHelper outputHelper)
309309
{
@@ -316,7 +316,7 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
316316
Assert.NotNull(test);
317317

318318
// The DisplayName is in the format:
319-
//
319+
//
320320
// Namespace.ClassName.MethodName(args)
321321
//
322322
// We only want the ClassName.MethodName portion.
@@ -326,7 +326,7 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
326326
// There should be 2 groups: the overall match, and the capture
327327
// group.
328328
Assert.Equal(2, match.Groups.Count);
329-
329+
330330
// The portion we want is in the capture group.
331331
return match.Groups[1].Value;
332332
}
@@ -337,7 +337,7 @@ public static string CurrentTestName(ITestOutputHelper outputHelper)
337337
// the name, or have (args...) appended.
338338
@"\.((?:[^.]+)\.(?:[^.\(]+))(?:\(.*\))?$",
339339
RegexOptions.Compiled);
340-
340+
341341
/// <summary>
342342
/// SQL Server properties we can query.
343343
///
@@ -351,7 +351,7 @@ public enum ServerProperty
351351
ProductMajorVersion,
352352
EngineEdition
353353
}
354-
354+
355355
public static string GetSqlServerProperty(string connectionString, ServerProperty property)
356356
{
357357
using SqlConnection conn = new(connectionString);
@@ -474,7 +474,7 @@ public static bool IsEnclaveAzureDatabaseSetup()
474474
public static bool IsNotAzureSynapse() => !IsAzureSynapse;
475475

476476
public static bool IsNotManagedInstance() => !IsManagedInstance;
477-
477+
478478
// Synapse: UDT Test Database not compatible with Azure Synapse.
479479
public static bool IsUdtTestDatabasePresent() => IsDatabasePresent(UdtTestDbName) && IsNotAzureSynapse();
480480

@@ -585,7 +585,7 @@ public static bool IsSupportingDistributedTransactions()
585585
public static bool IsUsingNativeSNI() =>
586586
#if !NETFRAMEWORK
587587
IsNotUsingManagedSNIOnWindows();
588-
#else
588+
#else
589589
true;
590590
#endif
591591
// Synapse: UTF8 collations are not supported with Azure Synapse.
@@ -671,25 +671,25 @@ private static string GetGuidParts()
671671
/// succession. The 12 characters are concatenated together without any
672672
/// separators.
673673
/// </summary>
674-
///
674+
///
675675
/// <param name="prefix">
676676
/// The prefix to use when generating the unique name, truncated to at
677677
/// most 18 characters when withBracket is false, and 16 characters when
678678
/// withBracket is true.
679679
///
680680
/// This should not contain any characters that cannot be used in
681681
/// database object names. See:
682-
///
682+
///
683683
/// https://learn.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-ver17#rules-for-regular-identifiers
684684
/// </param>
685-
///
685+
///
686686
/// <param name="withBracket">
687687
/// When true, the entire generated name will be enclosed in square
688688
/// brackets, for example:
689-
///
689+
///
690690
/// [MyPrefix_7ff01cb811f0]
691691
/// </param>
692-
///
692+
///
693693
/// <returns>
694694
/// A unique database object name, no more than 30 characters long.
695695
/// </returns>
@@ -723,7 +723,7 @@ public static string GetShortName(string prefix, bool withBracket = true)
723723
/// <summary>
724724
/// Generate a long unique database object name, whose maximum length is
725725
/// 96 characters, with the format:
726-
///
726+
///
727727
/// <Prefix>_<GuidParts>_<UserName>_<MachineName>
728728
///
729729
/// The Prefix will be truncated to satisfy the overall maximum length.
@@ -742,24 +742,24 @@ public static string GetShortName(string prefix, bool withBracket = true)
742742
/// The UserName and MachineName are obtained from the Environment,
743743
/// and will be truncated to satisfy the maximum overall length.
744744
/// </summary>
745-
///
745+
///
746746
/// <param name="prefix">
747747
/// The prefix to use when generating the unique name, truncated to at
748748
/// most 32 characters.
749749
///
750750
/// This should not contain any characters that cannot be used in
751751
/// database object names. See:
752-
///
752+
///
753753
/// https://learn.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-ver17#rules-for-regular-identifiers
754754
/// </param>
755-
///
755+
///
756756
/// <param name="withBracket">
757757
/// When true, the entire generated name will be enclosed in square
758758
/// brackets, for example:
759-
///
759+
///
760760
/// [MyPrefix_7ff01cb811f0_test_user_ci_agent_machine_name]
761761
/// </param>
762-
///
762+
///
763763
/// <returns>
764764
/// A unique database object name, no more than 96 characters long.
765765
/// </returns>
@@ -1332,7 +1332,7 @@ public readonly ref struct XEventScope // IDisposable
13321332

13331333
/// <summary>
13341334
/// Construct with the specified parameters.
1335-
///
1335+
///
13361336
/// This will use the connection to query the server properties and
13371337
/// setup and start the XEvent session.
13381338
/// </summary>
@@ -1350,7 +1350,7 @@ public XEventScope(
13501350
ushort durationInMinutes = 5)
13511351
{
13521352
SessionName = GenerateRandomCharacters(sessionName);
1353-
1353+
13541354
_connection = connection;
13551355
Assert.Equal(ConnectionState.Open, _connection.State);
13561356

@@ -1373,7 +1373,7 @@ public XEventScope(
13731373

13741374
// Setup and start the XEvent session.
13751375
string sessionLocation = _isAzureSql ? "DATABASE" : "SERVER";
1376-
1376+
13771377
// Both Azure SQL and SQL Server 2025+ support setting a maximum
13781378
// duration for the XEvent session.
13791379
string duration =
@@ -1394,7 +1394,7 @@ public XEventScope(
13941394
MEMORY_PARTITION_MODE=NONE,
13951395
TRACK_CAUSALITY=ON,
13961396
STARTUP_STATE=OFF)
1397-
1397+
13981398
ALTER EVENT SESSION [{SessionName}] ON {sessionLocation} STATE = START ";
13991399

14001400
using SqlCommand createXEventSession = new SqlCommand(xEventCreateAndStartCommandText, _connection);

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.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public enum AsyncAPI
2828
// Synapse: WAITFOR DELAY not supported [Parse error at line: 1, column: 1: Incorrect syntax near 'WAITFOR'.]
2929
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
3030
[ClassData(typeof(AsyncTimeoutTestVariations))]
31+
[Trait("Category", "flaky")]
3132
public static void TestDelayedAsyncTimeout(AsyncAPI api, string commonObj, int delayPeriod, bool marsEnabled) =>
3233
RunTest(api, commonObj, delayPeriod, marsEnabled);
3334

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public static class ConnectionPoolTest
3636
/// </summary>
3737
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
3838
[ClassData(typeof(ConnectionPoolConnectionStringProvider))]
39+
[Trait("Category", "flaky")]
3940
public static void BasicConnectionPoolingTest(string connectionString)
4041
{
4142
SqlConnection.ClearAllPools();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,7 @@ public _Row(int id, Guid documentIdentificationId, string name, string value)
904904
}
905905
}
906906

907+
[Trait("Category", "flaky")]
907908
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
908909
public static async Task CanReadAwkwardDataLengths()
909910
{

0 commit comments

Comments
 (0)