Incomplete unit test list due to very long test names

Hi there,

we encountered a quite rare error due to very long names of unit tests. If the name of a unit test is longer than 1024 characters the logging of the unit test results will fail with the attached exception sent to me via private messages. The worst problem with this error is that any other test result that could be stored in the database is excluded from the log as well. We got just 15 results of our 1020 unit tests added to the database.

In our case the unit test had two very long URLs (about 500 characters) as input and exptected result parameters which were included in the name of the tests. The tests name was 1027 characters long. I’d suggest to cut the name of test before adding it to the database context. We fixed our case by explicitly naming all tests with very long test parameters.

Continua CI version: 1.5.1.49
Unit test framework: NUnit 2.6.1

Regards

Kay Zumbusch

Exception detail:

NHibernate.Exceptions.GenericADOException: could not execute batch command.[SQL: SQL not available] —> System.Data.SqlClient.SqlException: String or binary data would be truncated.
Operation failed. The index entry of length 1592 bytes for the index ‘IX_builds_unittest_name’ exceeds the maximum length of 900 bytes.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) <br>at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) <br>at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean&amp; dataReady) <br>at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) <br>at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task&amp; task, Boolean asyncWrite, SqlDataReader ds) <br>at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) <br>at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() <br>at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery() <br>at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps) <br>--- End of inner exception stack trace --- <br>at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps) <br>at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps) <br>at NHibernate.AdoNet.SqlClientBatchingBatcher.AddToBatch(IExpectation expectation) <br>at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object&#91;&#93; fields, Boolean&#91;&#93; notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) <br>at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object&#91;&#93; fields, Object obj, ISessionImplementor session) <br>at NHibernate.Impl.StatelessSessionImpl.Insert(String entityName, Object entity) <br>at NHibernate.Impl.StatelessSessionImpl.Insert(Object entity) <br>at Continua.Modules.Builds.UnitTests.UnitTestManager.RegisterUnitTests(Int32 buildId, Guid stageId, IList1 unitTests, IEnumerable`1 metrics, Boolean isFirstCall)

Hi Kay,

Thanks for reporting this. This is confirmed as still a bug in the latest version when using SQL Server. Somehow the unit test field lengths were set to be longer on PostgreSql. We will implement a fix for the next version.