Skip to content

Commit dd0b53a

Browse files
committed
Fix timeout tests for MySql.Data 8.0.11.
Connector/NET now throws a "Fatal error encountered during command execution" exception and closes the connection.
1 parent dde2821 commit dd0b53a

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

tests/SideBySide/CommandTimeoutTests.cs

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ namespace SideBySide
99
{
1010
public class CommandTimeoutTests : IClassFixture<DatabaseFixture>, IDisposable
1111
{
12+
#if BASELINE
13+
const string c_timeoutMessage = "fatal error";
14+
#else
15+
const string c_timeoutMessage = "timeout";
16+
#endif
17+
1218
public CommandTimeoutTests(DatabaseFixture database)
1319
{
1420
m_database = database;
@@ -73,17 +79,12 @@ public void CommandTimeoutWithSleepSync()
7379
catch (MySqlException ex)
7480
{
7581
sw.Stop();
76-
Assert.Contains("timeout", ex.Message, StringComparison.OrdinalIgnoreCase);
77-
#if !BASELINE
78-
// https://bugs.mysql.com/bug.php?id=86009
82+
Assert.Contains(c_timeoutMessage, ex.Message, StringComparison.OrdinalIgnoreCase);
7983
TestUtilities.AssertDuration(sw, cmd.CommandTimeout * 1000 - 100, 500);
80-
#endif
8184
}
8285
}
8386

84-
#if !BASELINE
8587
Assert.Equal(ConnectionState.Closed, m_connection.State);
86-
#endif
8788
}
8889

8990
[Fact]
@@ -104,17 +105,12 @@ public async Task CommandTimeoutWithSleepAsync()
104105
catch (MySqlException ex)
105106
{
106107
sw.Stop();
107-
Assert.Contains("timeout", ex.Message, StringComparison.OrdinalIgnoreCase);
108-
#if !BASELINE
109-
// https://bugs.mysql.com/bug.php?id=86009
108+
Assert.Contains(c_timeoutMessage, ex.Message, StringComparison.OrdinalIgnoreCase);
110109
TestUtilities.AssertDuration(sw, cmd.CommandTimeout * 1000 - 100, 500);
111-
#endif
112110
}
113111
}
114112

115-
#if !BASELINE
116113
Assert.Equal(ConnectionState.Closed, m_connection.State);
117-
#endif
118114
}
119115

120116
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=87307")]
@@ -154,9 +150,7 @@ public void MultipleCommandTimeoutWithSleepSync()
154150
}
155151
}
156152

157-
#if !BASELINE
158153
Assert.Equal(ConnectionState.Closed, m_connection.State);
159-
#endif
160154
}
161155

162156
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=87307")]
@@ -195,9 +189,7 @@ public async Task MultipleCommandTimeoutWithSleepAsync()
195189
}
196190
}
197191

198-
#if !BASELINE
199192
Assert.Equal(ConnectionState.Closed, m_connection.State);
200-
#endif
201193
}
202194

203195
[SkippableFact(Baseline = "https://bugs.mysql.com/bug.php?id=88124")]
@@ -264,17 +256,12 @@ public void TransactionCommandTimeoutWithSleepSync()
264256
catch (MySqlException ex)
265257
{
266258
sw.Stop();
267-
Assert.Contains("timeout", ex.Message, StringComparison.OrdinalIgnoreCase);
268-
#if !BASELINE
269-
// https://bugs.mysql.com/bug.php?id=86009
259+
Assert.Contains(c_timeoutMessage, ex.Message, StringComparison.OrdinalIgnoreCase);
270260
TestUtilities.AssertDuration(sw, cmd.CommandTimeout * 1000 - 100, 500);
271-
#endif
272261
}
273262
}
274263

275-
#if !BASELINE
276264
Assert.Equal(ConnectionState.Closed, m_connection.State);
277-
#endif
278265
}
279266

280267
[Fact]
@@ -296,17 +283,11 @@ public async Task TransactionCommandTimeoutWithSleepAsync()
296283
catch (MySqlException ex)
297284
{
298285
sw.Stop();
299-
Assert.Contains("timeout", ex.Message, StringComparison.OrdinalIgnoreCase);
300-
#if !BASELINE
301-
// https://bugs.mysql.com/bug.php?id=86009
302-
TestUtilities.AssertDuration(sw, cmd.CommandTimeout * 1000 - 100, 500);
303-
#endif
286+
Assert.Contains(c_timeoutMessage, ex.Message, StringComparison.OrdinalIgnoreCase);
304287
}
305288
}
306289

307-
#if !BASELINE
308290
Assert.Equal(ConnectionState.Closed, m_connection.State);
309-
#endif
310291
}
311292

312293
readonly DatabaseFixture m_database;

0 commit comments

Comments
 (0)