Ok, so after reinstalling and reconfiguring my stuff I checked out a group of three projects we're working on. Projects that our Hudson guarantees as healthy (see one below).
Open the group of projects, set as main, fix the configurations for my local databases (for each database we have one instance for manual and acceptance tests and one for the automated ones) configurations clean and build, test (just to be sure).
91% passed. What? That means fail! but... what's wrong? mmm... it seems there's a row in the User table that causes Hibernate to complain about constraint violations. That is strange, as - as far as I know, but I obviously might be wrong - all our automated persistence tests run with HibernateOpenViewSession, a simple Runner that before each test opens a Session and rollbacks everything after the invocation (nothing new under the sun, but quite handy):
@Override
protected void invokeTestMethod(Method method, RunNotifier notifier) {
try {
final Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
super.invokeTestMethod(method, notifier);
if (session.isOpen()) {
session.clear();
session.getTransaction().rollback();
}
if (session.isOpen()) {
session.close();
}
} catch (Throwable t) {
System.err.println("HibernateOpenViewSession RUNNER FAILURE");
notifier.fireTestFailure(new Failure(Description.EMPTY, t));
}
}
Yet, that row is still there. Well, maybe one of our tests doesn't use our favourite runner. So, why doesn't Hudson complain? After a little investigation it turned out that the Hibernate configuration for our CI server has a hibernate.hbm2ddl.auto=create property, where my local file had update. That fixed, all my local files ran smoothly and gave me a green bar.
Now the hunt for Red October will start. Ehm... I meant the hunt for the culprit test, of course... I'll keep my eyes on the ball.
By the way, we almost reached our 1000th test on the project :-) and it is only part of a group of three... it may sound a little to many out there, but for us it is a great success.
As a parting note, let me stress again the importance of a CI server to avoid the "it runs on my machine" syndrome - which in this case was "it doesn't work on my machine" :-)
No comments:
Post a Comment