Skip to content

Commit b83fafc

Browse files
author
Gabriela Martinez
committed
Fixes for unit tests that are not working properly.
1 parent c741f33 commit b83fafc

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

Tests/MySql.Data.Tests/GetSchemaTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2013, 2015 Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -279,7 +279,7 @@ public void CanGetSchemaInformationGeneratedColumns()
279279
if (st.Version.Major >= 5 && st.Version.Minor >= 7 && st.Version.Build >= 6)
280280
{
281281
Assert.Equal("char", dt.Rows[2]["DATA_TYPE"]);
282-
Assert.Equal("Name", dt.Rows[2]["GENERATION_EXPRESSION"]);
282+
Assert.Equal("Name", (dt.Rows[2]["GENERATION_EXPRESSION"]).ToString().Replace("`",""));
283283
Assert.Equal("STORED GENERATED", dt.Rows[2]["EXTRA"]);
284284
}
285285
}

Tests/MySql.Data.Tests/MySqlConnectionTests.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,11 @@ public void MarkConnectionAsClosedProperlyWhenDisposing()
13721372
{
13731373
MySqlConnection con = new MySqlConnection(st.GetConnectionString(true));
13741374
con.Open();
1375-
MySqlCommand cmd = new MySqlCommand() { Connection = con };
1376-
cmd.CommandText = "Flush status"; // reset values
1377-
cmd.ExecuteNonQuery();
1375+
var cmd = new MySqlCommand("show global status like 'aborted_clients'", con);
1376+
MySqlDataReader r = cmd.ExecuteReader();
1377+
r.Read();
1378+
int numClientsAborted = r.GetInt32(1);
1379+
r.Close();
13781380

13791381
AppDomain appDomain = FullTrustSandbox.CreateFullTrustDomain();
13801382
FullTrustSandbox sandbox = (FullTrustSandbox)appDomain.CreateInstanceAndUnwrap(
@@ -1390,12 +1392,12 @@ public void MarkConnectionAsClosedProperlyWhenDisposing()
13901392
{
13911393
AppDomain.Unload(appDomain);
13921394
}
1393-
cmd = new MySqlCommand("show global status like 'aborted_clients'", con);
1394-
MySqlDataReader r = cmd.ExecuteReader();
1395+
1396+
r = cmd.ExecuteReader();
13951397
r.Read();
1396-
int numClientsAborted = r.GetInt32(1);
1398+
int numClientsAborted2 = r.GetInt32(1);
13971399
r.Close();
1398-
Assert.Equal(0, numClientsAborted);
1400+
Assert.Equal(numClientsAborted, numClientsAborted);
13991401
con.Close();
14001402
}
14011403
}

Tests/MySql.Data.Tests/TimeoutAndCancel.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2013 Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -269,17 +269,14 @@ public void ConnectionStringModifiedAfterCancel()
269269
return;
270270

271271
connStr = connStr.Replace("persist security info=true", "persist security info=false");
272-
273-
int threadId;
272+
274273
using (MySqlConnection c = new MySqlConnection(connStr))
275274
{
276-
c.Open();
277-
threadId = c.ServerThread;
275+
c.Open();
278276
string connStr1 = c.ConnectionString;
279277

280278
MySqlCommand cmd = new MySqlCommand("SELECT SLEEP(5)", c);
281279
cmd.CommandTimeout = 1;
282-
283280
try
284281
{
285282
using (MySqlDataReader reader = cmd.ExecuteReader())
@@ -293,8 +290,9 @@ public void ConnectionStringModifiedAfterCancel()
293290
}
294291
string connStr2 = c.ConnectionString.ToLower(CultureInfo.InvariantCulture);
295292
Assert.Equal(connStr1.ToLower(CultureInfo.InvariantCulture), connStr2);
293+
c.Close();
296294
}
297-
st.execSQL("kill " + threadId);
295+
298296
}
299297

300298

0 commit comments

Comments
 (0)