“If you don’t like testing your product, most likely your customers won’t like to test it either.” - Anonymous
A message broker or any other software should always be tested extensively to make sure it is working as expected. That is why we always try to improve the way we are testing WSO2 MB. Since WSO2 MB is used mostly in clustered mode, we need to test and see how WSO2 MB behave in a clustered environment. Prior to WSO2 MB 3.0.0, this was a manual process which resulted in wasting valuable time and resources. I am writing this post to tell you how to configure and run the clustered integration tests introduced in WSO2 MB 3.0.0.
We have not still automated the MB cluster creation process yet. In a future release we will be able to automate this process also. But for the moment we have to create the cluster manually. With the removal of Apache ZooKeeper dependency from WSO2 MB, this is not very hard to do. I am not going to describe how to setup a MB cluster in this post. You can follow the WSO2 MB documentation to properly setup a MB cluster.
Configuring test framework
I am using a two node WSO2 MB cluster for this example. Let’s assume the MB Node details in the cluster are as follows,
MB Node 1
- Host name/IP: 192.168.1.5
- HTTP port : 9763
- HTTPS port : 9443
- AMQP port : 5672
- MQTT Port : 1883
MB Node 2
- Host name/IP: 192.168.1.6
- HTTP port : 9763
- HTTPS port : 9443
- AMQP port : 5672
- MQTT Port : 1883
1. First We have to enter this node information in the automation.xml file of the tests-clustering module. An example configuration is mentioned below
2. Also edit the datasource information in the automation.xml to match your MySQL database configuration for the message store. Please note that we currently only support MySQL database for Cluster Testing even-though WSO2 MB supports several database systems like MySQL, MSSQL, and Oracle.
3. We have to also change the value of “skipPlatformTests” property to false in the pom.xml of tests-clustering module to enable clustered integrations tests.
4. Now we can run the clustered test by executing
in the
product-mb/modules/integration/ directory.1
mvn clean install
GIT trick to configure quickly
It is a pain to do all these configuration every time we need to run cluster tests. What I do to avoid that is keeping all these configuration changes in GIT stash. Then when ever I need to run the cluster tests, I can simply apply the stash and run tests.