Skip to content

Commit cb54bd0

Browse files
committed
Fix test failures for Firebird
1 parent 22908b5 commit cb54bd0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/NHibernate.Test/CfgTest/ConfigurationSerializationTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Runtime.Serialization.Formatters.Binary;
44
using NHibernate.Cfg;
55
using NHibernate.DomainModel;
6+
using NHibernate.Driver;
7+
using NHibernate.Engine;
68
using NHibernate.Tool.hbm2ddl;
79
using NUnit.Framework;
810

@@ -82,6 +84,18 @@ public void Basic_CRUD_should_work()
8284
var p = session.Get<Parent>(parentId);
8385
Assert.That(p, Is.Null);
8486
}
87+
88+
if (((ISessionFactoryImplementor) sf).ConnectionProvider.Driver is FirebirdClientDriver fbDriver)
89+
{
90+
// Firebird will pool each connection created during the test and will marked as used any table
91+
// referenced by queries. It will at best delays those tables drop until connections are actually
92+
// closed, or immediately fail dropping them.
93+
// This results in other tests failing when they try to create tables with same name.
94+
// By clearing the connection pool the tables will get dropped. This is done by the following code.
95+
// Moved from NH1908 test case, contributed by Amro El-Fakharany.
96+
fbDriver.ClearPool(null);
97+
}
98+
8599
export.Drop(true, true);
86100
}
87101
}

src/NHibernate.Test/Tools/hbm2ddl/SchemaMetadataUpdaterTest/SchemaMetadataUpdaterFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public void CanWorkWithAutoQuoteTableAndColumnsAtStratup()
248248
t.Commit();
249249
}
250250

251-
new SchemaExport(configuration).Drop(false, false);
251+
new SchemaExport(configuration).Drop(false, true);
252252
}
253253

254254
[Test]

0 commit comments

Comments
 (0)