Repository unit tests hang when run against latest git, due to messaging subsystem

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
gagravarr
Active Member

Repository unit tests hang when run against latest git, due to messaging subsystem

This is mostly a heads-up for anyone trying to run Repository unit tests on the latest version of the alfresco-repository from Github. TL;DR the defaults now assume you have the message bus stuff running and available, the readme doesn't, and you need to set messaging.subsystem.autoStart=false to get your tests to not hang

Last week, I thought I'd found a bug in the Repo. (Spoiler - I did, reported and suggested fix as Mail action executor better html detection by Gagravarr · Pull Request #364 · Alfresco/alfresco-repo... ). So, the first thing I did was checkout the latest code from Github. My plan was to add a failing unit test, fix it, see the unit test pass, then contribute back. But before that, I needed to run the existing unit test just to ensure I had everything setup.

I followed the instructions in the README, and (with a tweak to set the test name and db name) ran:

mvn clean test -Dtest=org.alfresco.repo.action.executer.MlActionExecuterTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco_test -Ddb.url=jdbcSmiley Tongueostgresql:alfresco_test -Ddb.username=alfresco -Ddb.password=alfresco

And... It just hung, the last log line was

INFO  [org.alfresco.repo.management.subsystems.ChildApplicationContextFactory] [main] Starting 'Messaging' subsystem, ID: [Messaging, default]

It turns out that the repo by default now needs the ActiveMQ message broker stuff that was talked about at devcon. No mention in the readme, but without it, it'll hang. Poking around, I discovered that the magic property to disable it (since the functionality I needed to test didn't use it) is

messaging.subsystem.autoStart=false

With that set, the unit test ran! I was able to add the extra checks, fix the bug, and contribute back. My working maven command was then

mvn clean test -Dtest=org.alfresco.repo.action.executer.MailActionExecuterTest -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco_test -Ddb.url=jdbcSmiley Tongueostgresql:alfresco_test -Ddb.username=alfresco -Ddb.password=alfresco -Dmessaging.subsystem.autoStart=false

Hope that helps anyone else trying to run the repo unit tests!

3 Replies
afaust
Master

Re: Repository unit tests hang when run against latest git, due to messaging subsystem

Yeah - that Messaging subsystem is a huge pain in the ***. It does not have any sort of a connection timeout to deal with unavailability of ActiveMQ, and should be completely optional (Alfresco works perfectly fine without it, and most people likely won't need / use the out-of-process event handling stuff anytime soon).

But I am quite surprised that the unit tests run at all after you disabled that subsystem's auto-start. When I worked on an enhancement for the ReST API around the turn of the year, nothing I did was able to make it run locally and had to rely on their Travis CI build for Pull Requests to run the unit tests. Basically I had to develop my test additions in the blind, push, test, repeat - even going so far as adding temporary logging / debugging code I could then see the output of in the Travis CI log. In the end, I reverted those temporary commits and re-applied the changes in a clean way for the PR.

afaust
Master

Re: Repository unit tests hang when run against latest git, due to messaging subsystem

Since I just found out today, I have to make an addendum to my previous reply, so that people stumbling over it do not get the wrong impression. It turns out that Active MQ is used and required for ONE (1 !) small feature in Alfresco CE 6.1.2 GA: Refreshing / regenerating renditions when the content of a node changes. If the Messaging and Events subsystems are disabled, renditions will no longer be automatically refreshed.

douglascrp
Advanced II

Re: Repository unit tests hang when run against latest git, due to messaging subsystem

Wow.... so does that mean the thumbnails shown in Share are not going to be refreshed?