Federation testing for a buddcloud server setup.
The Buddycloud channel server has over 700 unit tests which helps us have a high level of confidence when rolling out updates to production (_please_feel_free_to_contributemore!). That said, some things can't, or are more easily, tested via integration tests. This is where this suite kicks in.
The job of this set up is to run up several Buddycloud channel servers connected to an XMPP server and fire messages at the server and to check that responses are as expected. Running up several servers also allows us to check that federation is working too.
Primarily this setup is designed to be run on travisci on commit to the
master branch of the Buddycloud channel server and may eventually be integrated into a bigger test suite (before the docker image is generated for example).
You will need:
- An XMPP server set up. We recommend Prosody, an example configuration can be found here
- Node.js installed (version 0.10 or greater)
- PostgreSQL 9.3
- Java JDK
This project also has an automated docker build which you can use, rather than installing all the parts onto your system. To use the docker image run the following:
docker run -d --name buddycloud-integration-tests -p 5432:5432 -p 5222:5222 -p 5347:5347 buddycloud/integration-testing
If you are running postgresql or an XMPP server locally then you'll probably want to change those port mappings and use the
DATABASE_PORT environment variables.
You'll also need to set:
export DATABASE_HOST=localdocker(or similar)
Back to it....
You'll then need to set up some databases and configuration files:
- To install the channel server run the
setup-buddycloud.shscript in the resources directory
- Install the databases, run
setup-database.shin the resources directory. If your postgres server is not on localhost then set an environment variable of
DATABASE_HOSTto point to its location, additionally a non-standard port number use
- You need to set up some configuration files. See the travisci examples, you will need to create a set of files in a directory named after your
NODE_ENVenvironment variable (defaults to development)
# install dependencies npm i . # run the tests npm test # profit
Note: To see more details on the running tests run as follows:
DEBUG=tests* npm test
If not using localhost or a different xmpp client port number then you'll need to set
XMPP_PORT environment variables.