Issue running Tests which Integrate with NHibernate/SQLite Under Ubuntu/Mono
I have some unit tests which use NHibernate and an In memory SQLite db, now these tests pass 100% of the time running from CLI under both windows and linux using my nant build file.
Now the same build file running on team city randomly fails with this error:
NHibernate.Exceptions.GenericADOException : could not insert: [eTrustMax.Domain.Customer#20fbfa7a-1356-4089-a3b5-9dc7000cbf09][SQL: INSERT INTO Customers (Name, Id) VALUES (?, ?)]
----> System.Data.SQLite.SQLiteException : SQLite error
no such table: Customers
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert (System.Object id, System.Object[] fields, System.Boolean[] notNull, Int32 j, NHibernate.SqlCommand.SqlCommandInfo sql, System.Object obj, ISessionImplementor session) [0x00000] in <filename unknown>:0
at NHibernate.Persister.Entity.AbstractEntityPersister.Insert (System.Object id, System.Object[] fields, System.Object obj, ISessionImplementor session) [0x00000] in <filename unknown>:0
at NHibernate.Action.EntityInsertAction.Execute () [0x00000] in <filename unknown>:0
at NHibernate.Engine.ActionQueue.Execute (IExecutable executable) [0x00000] in <filename unknown>:0
at NHibernate.Engine.ActionQueue.ExecuteActions (IList list) [0x00000] in <filename unknown>:0
at NHibernate.Engine.ActionQueue.ExecuteActions () [0x00000] in <filename unknown>:0
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions (IEventSource session) [0x00000] in <filename unknown>:0
--GenericADOException
at System.Data.SQLite.SQLite3.Prepare (System.Data.SQLite.SQLiteConnection cnn, System.String strSql, System.Data.SQLite.SQLiteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0
at System.Data.SQLite.SQLiteCommand.BuildNextCommand () [0x00000] in <filename unknown>:0
------- Stdout: -------
drop table if exists Customers
create table Customers (
Id UNIQUEIDENTIFIER not null,
Name TEXT,
primary key (Id)
)
NHibernate: INSERT INTO Customers (Name, Id) VALUES (@p0, @p1);@p0 = 'Test', @p1 = 20fbfa7a-1356-4089-a3b5-9dc7000cbf09
-------------
I am not sure why it seems to randomly loose the connection to the in memory db, if I were to re run the build it would then pass fine, sometimes it might need to be run a couple times, seems very random.
Cheers
Stefan
Please sign in to leave a comment.
Could you please try running those unit tests with NUnit-Console.exe test runner. Will those tests continue failing? Please see http://confluence.jetbrains.net/display/TCD5/TeamCity+Addin+for+NUnit for details on how to make TeamCity reporing unit tests when using NUnit-Console.exe
Could not Figure out the nunit console runner for a Nant build it has no such option available, I tried changing nant version by adding:
<property name="teamcity.dotnet.nant.nunit2.version" value="NUnit-2.4.8" />
To the build file hoping it would work, it built 10 times in a row this time but then failed again :(
Thanks
Stefan
Oh right so you mean not using an <nunit2> task but executing the console with an <exec> right?
Yes, I mean using <exec> task to feagure out where is the issue.
What version of NUnit was used in your project?
Please check you make unit tests run under x86