Skip to content

Commit 241ba99

Browse files
committed
Enable cancel tests for MySQL but not MariaDB.
MariaDB sends an error payload that causes an exception in the tests; MySQL uses the return value of SLEEP(n) to indicate cancellation.
1 parent 7df35ef commit 241ba99

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ jobs:
231231
'MariaDB 10.4':
232232
image: 'mariadb:10.4'
233233
connectionStringExtra: ''
234-
unsupportedFeatures: 'CachingSha2Password,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
234+
unsupportedFeatures: 'CachingSha2Password,CancelSleepSuccessfully,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
235235
'MariaDB 10.5':
236236
image: 'mariadb:10.5'
237237
connectionStringExtra: ''
238-
unsupportedFeatures: 'CachingSha2Password,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
238+
unsupportedFeatures: 'CachingSha2Password,CancelSleepSuccessfully,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
239239
'MariaDB 10.6':
240240
image: 'mariadb:10.6'
241241
connectionStringExtra: ''
242-
unsupportedFeatures: 'CachingSha2Password,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
242+
unsupportedFeatures: 'CachingSha2Password,CancelSleepSuccessfully,Json,RoundDateTime,QueryAttributes,Sha256Password,Tls11,UuidToBin'
243243
steps:
244244
- template: '.ci/integration-tests-steps.yml'
245245
parameters:

tests/SideBySide/CancelTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void NoCancel()
2121
Assert.InRange(stopwatch.ElapsedMilliseconds, 100, 1000);
2222
}
2323

24-
[SkippableFact(ServerFeatures.Timeout)]
24+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
2525
public void CancelCommand()
2626
{
2727
using var cmd = new MySqlCommand("SELECT SLEEP(5)", m_database.Connection);
@@ -380,7 +380,7 @@ public async Task CancelMultiStatementInRead()
380380
}
381381

382382
#if !BASELINE
383-
[SkippableFact(ServerFeatures.Timeout)]
383+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
384384
public void CancelBatchCommand()
385385
{
386386
using var batch = new MySqlBatch(m_database.Connection)

tests/SideBySide/CommandTimeoutTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void LargeCommandTimeoutIsCoerced()
4646
Assert.Equal(2_147_483, command.CommandTimeout);
4747
}
4848

49-
[SkippableFact(ServerFeatures.Timeout)]
49+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
5050
public void CommandTimeoutWithSleepSync()
5151
{
5252
var connectionState = m_connection.State;
@@ -72,7 +72,7 @@ public void CommandTimeoutWithSleepSync()
7272
Assert.Equal(connectionState, m_connection.State);
7373
}
7474

75-
[SkippableFact(ServerFeatures.Timeout)]
75+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully | ServerFeatures.Timeout)]
7676
public async Task CommandTimeoutWithSleepAsync()
7777
{
7878
var connectionState = m_connection.State;
@@ -98,7 +98,7 @@ public async Task CommandTimeoutWithSleepAsync()
9898
Assert.Equal(connectionState, m_connection.State);
9999
}
100100

101-
[SkippableTheory(ServerFeatures.Timeout)]
101+
[SkippableTheory(ServerFeatures.CancelSleepSuccessfully)]
102102
[InlineData(true)]
103103
[InlineData(false)]
104104
public void CommandTimeoutWithStoredProcedureSleepSync(bool pooling)
@@ -136,7 +136,7 @@ create procedure sleep_sproc(IN seconds INT)
136136
TestUtilities.AssertDuration(sw, cmd.CommandTimeout * 1000 - 100, 500);
137137
}
138138

139-
[SkippableFact(ServerFeatures.Timeout)]
139+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
140140
public void MultipleCommandTimeoutWithSleepSync()
141141
{
142142
var connectionState = m_connection.State;
@@ -170,7 +170,7 @@ public void MultipleCommandTimeoutWithSleepSync()
170170
Assert.Equal(connectionState, m_connection.State);
171171
}
172172

173-
[SkippableFact(ServerFeatures.Timeout)]
173+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully | ServerFeatures.Timeout)]
174174
public async Task MultipleCommandTimeoutWithSleepAsync()
175175
{
176176
var connectionState = m_connection.State;
@@ -203,7 +203,7 @@ public async Task MultipleCommandTimeoutWithSleepAsync()
203203
Assert.Equal(connectionState, m_connection.State);
204204
}
205205

206-
[SkippableFact(ServerFeatures.Timeout, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
206+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
207207
public void CommandTimeoutResetsOnReadSync()
208208
{
209209
var csb = new MySqlConnectionStringBuilder(m_connection.ConnectionString);
@@ -224,7 +224,7 @@ public void CommandTimeoutResetsOnReadSync()
224224
Assert.Equal(ConnectionState.Open, m_connection.State);
225225
}
226226

227-
[SkippableFact(ServerFeatures.Timeout, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
227+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully | ServerFeatures.Timeout, Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
228228
public async Task CommandTimeoutResetsOnReadAsync()
229229
{
230230
var csb = new MySqlConnectionStringBuilder(m_connection.ConnectionString);
@@ -246,7 +246,7 @@ public async Task CommandTimeoutResetsOnReadAsync()
246246
}
247247

248248

249-
[SkippableFact(ServerFeatures.Timeout)]
249+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
250250
public void TransactionCommandTimeoutWithSleepSync()
251251
{
252252
var connectionState = m_connection.State;
@@ -273,7 +273,7 @@ public void TransactionCommandTimeoutWithSleepSync()
273273
Assert.Equal(connectionState, m_connection.State);
274274
}
275275

276-
[SkippableFact(ServerFeatures.Timeout)]
276+
[SkippableFact(ServerFeatures.CancelSleepSuccessfully)]
277277
public async Task TransactionCommandTimeoutWithSleepAsync()
278278
{
279279
var connectionState = m_connection.State;

tests/SideBySide/ServerFeatures.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ public enum ServerFeatures
3030
/// The MySQL server can start streaming rows back as soon as they are available, as opposed to buffering the entire result set in memory.
3131
/// </summary>
3232
StreamingResults = 0x20_0000,
33+
34+
/// <summary>
35+
/// A "SLEEP" command produces a result set when it is cancelled, not an error payload.
36+
/// </summary>
37+
CancelSleepSuccessfully = 0x40_0000,
3338
}

0 commit comments

Comments
 (0)