Skip to content

Commit 075d642

Browse files
committed
clear the pool after the test
1 parent 0bf6e35 commit 075d642

File tree

1 file changed

+18
-0
lines changed
  • src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety

1 file changed

+18
-0
lines changed

src/NHibernate.Test/NHSpecificTest/NH1908ThreadSafety/Fixture.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading;
5+
using NHibernate.Util;
56
using NUnit.Framework;
67

78
namespace NHibernate.Test.NHSpecificTest.NH1908ThreadSafety
@@ -17,6 +18,23 @@ protected override bool AppliesTo(Dialect.Dialect dialect)
1718
// http://www.orafaq.com/forum/t/60019/2/ & http://www.ispirer.com/wiki/sqlways/troubleshooting-guide/oracle/import/tns_listener
1819
}
1920

21+
protected override void OnTearDown()
22+
{
23+
base.OnTearDown();
24+
25+
if (!(Dialect is Dialect.FirebirdDialect))
26+
return;
27+
28+
// Firebird will pool each connection created during the test and will not drop the created tables
29+
// which will result in other tests failing when they try to create tables with same name
30+
// By clearing the connection pool the tables will get dropped. This is done by the following code.
31+
var fbConnectionType = ReflectHelper.TypeFromAssembly("FirebirdSql.Data.FirebirdClient.FbConnection", "FirebirdSql.Data.FirebirdClient", false);
32+
var clearPool = fbConnectionType.GetMethod("ClearPool");
33+
var sillyConnection = sessions.ConnectionProvider.GetConnection();
34+
clearPool.Invoke(null, new object[] { sillyConnection });
35+
sessions.ConnectionProvider.CloseConnection(sillyConnection);
36+
}
37+
2038
[Test]
2139
public void UsingFiltersIsThreadSafe()
2240
{

0 commit comments

Comments
 (0)