Skip to content

Commit b8969d9

Browse files
author
Jose Ramirez
committed
Fixed failing tests due to closed connections.
1 parent 172d707 commit b8969d9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Tests/MySql.Data.Tests/MySqlConnectionTests.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public class MySqlConnectionTests : IUseFixture<SetUpClass>, IDisposable
4343

4444
public void SetFixture(SetUpClass data)
4545
{
46-
st = data;
46+
st = data;
47+
if (st.conn.State != ConnectionState.Open && !st.conn.SoftClosed)
48+
st.conn.Open();
4749
}
4850

4951
[Fact]
@@ -1190,6 +1192,7 @@ public void TestNonSupportedOptions()
11901192
{
11911193
c.Open();
11921194
Assert.Equal(ConnectionState.Open, c.State);
1195+
c.Close();
11931196
}
11941197
}
11951198

@@ -1328,6 +1331,7 @@ public void SslPreferredByDefault()
13281331
Assert.True(reader.Read());
13291332
Assert.True(reader.GetString(1).StartsWith("TLSv1"));
13301333
}
1334+
connection.Close();
13311335
}
13321336
}
13331337

@@ -1344,6 +1348,7 @@ public void SslOverrided()
13441348
Assert.True(reader.Read());
13451349
Assert.Equal(string.Empty, reader.GetString(1));
13461350
}
1351+
connection.Close();
13471352
}
13481353
}
13491354

@@ -1481,6 +1486,7 @@ public void ConnectUsingSha256PasswordPlugin()
14811486
if (!string.IsNullOrEmpty(reader.GetString(1))) serverCompiledUsingOpenSsl = true;
14821487
}
14831488
}
1489+
connection.Close();
14841490
}
14851491

14861492
Settings.SslMode = MySqlSslMode.None;
@@ -1633,6 +1639,8 @@ public void ConnectUsingCachingSha2Plugin()
16331639
if (!string.IsNullOrEmpty(reader.GetString(1))) serverCompiledUsingOpenSsl = true;
16341640
}
16351641
}
1642+
1643+
connection.Close();
16361644
}
16371645

16381646
st.ExecuteSQLAsRoot("FLUSH PRIVILEGES");
@@ -1708,6 +1716,8 @@ public void AllowPublicKeyRetrievalForSha256PasswordPlugin()
17081716
if (!string.IsNullOrEmpty(reader.GetString(1))) serverCompiledUsingOpenSsl = true;
17091717
}
17101718
}
1719+
1720+
connection.Close();
17111721
}
17121722

17131723
Settings.SslMode = MySqlSslMode.None;
@@ -1764,6 +1774,7 @@ public void AllowPublicKeyRetrievalForCachingSha2PasswordPlugin()
17641774

17651775
command.CommandText = "FLUSH PRIVILEGES";
17661776
command.ExecuteNonQuery();
1777+
connection.Close();
17671778
}
17681779

17691780
Settings.SslMode = MySqlSslMode.None;
@@ -1817,6 +1828,8 @@ public void CachingSha2AuthFailsAfterFlushPrivileges()
18171828
if (!string.IsNullOrEmpty(reader.GetString(1))) serverCompiledUsingOpenSsl = true;
18181829
}
18191830
}
1831+
1832+
connection.Close();
18201833
}
18211834

18221835
Settings.SslMode = MySqlSslMode.Required;

0 commit comments

Comments
 (0)