Long Test Class Names cause builds to fail to finish

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When a build runs with test class names longer than 4000 characters, the following may appear in the atlassian-bamboo.log

2018-05-22 19:43:34,104 INFO [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [AbstractBatchImpl] HHH000010: On release of batch it still contained JDBC statements
2018-05-22 19:43:34,104 ERROR [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [BatchingBatch] HHH000315: Exception executing batch [java.sql.BatchUpdateException: String or binary data would be truncated.], SQL: insert into TEST_CLASS (TEST_CLASS_NAME, PLAN_ID, TEST_CLASS_ID) values (?, ?, ?)
2018-05-22 19:43:34,104 WARN [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [SqlExceptionHelper] SQL Error: 8152, SQLState: 22001
2018-05-22 19:43:34,104 ERROR [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [SqlExceptionHelper] String or binary data would be truncated.
2018-05-22 19:43:34,104 INFO [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [DefaultErrorHandler] Recording an error: Could not save the build results. Data could be in an inconsistent state. : USAPI-USAPIREGR-JOB1 : org.hibernate.exception.DataException: could not execute batch
2018-05-22 19:43:34,104 FATAL [9-BuildTailMessageProcessingThread-expensive:pool-17-thread-708] [PlanStatePersisterImpl] Could not save the build results BuildResults: PROJ-PLAN-JOB-###. Data could be in an inconsistent state.
javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute batch
...
Caused by: org.hibernate.exception.DataException: could not execute batch
...
Caused by: java.sql.BatchUpdateException: String or binary data would be truncated.
...

Cause

The TEST_CLASS_NAME column in the TEST_CLASS table, which stores the Test class name has a limit of 4000 characters. If this is too long, the SQL query to INSERT the value will fail with the stack trace above. The build will run successfully, but the error will appear when saving the test results.

Resolution

  1. Find any Test classes in your test suite that have names with 4000 characters or more
  2. Edit those test classes to have name less than 4000 characters
  3. Run the failing build again


Last modified on May 24, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.