End-to-end tests for Minion/OpenNMS that leverage Docker for managing services.
These tests we’re built to automate the validation of application-layer functionality in Minion/OpenNMS, also referred to herein as the Minion System.
The framework provides the ability to instantiate a Minion System on the local, or a remote host using a collection of linked Docker containers. Once instantiated, references to the various hosts and ports for all of the services (i.e. OpenNMS HTTP, Minion Karaf Shell) are available, and control is passed to the test suite.
-
Docker v1.10.x (tested with 1.10.3, build 20f81dd)
-
Maven v3.3.x (tested with 3.3.3)
-
Java 8 (tested with Oracle JDK 1.8.0_45-b14)
We use the Spotify Docker Client to communicate with the Docker daemon.
The location of the Docker daemon can be controlled with the DOCKER_HOST environment variable. If the Docker daemon is running on the localhost, no extra configuration should be required.
The Docker images depend on the .rpms generated by the build.
After obtaining the sources, run the following to build the RPMs:
Note
|
You currently need to checkout the develop branch. |
./makerpm.sh export OPENNMS_BUILD=$(pwd)
Build the Docker images with:
pushd docker ./copy-rpms.sh ./build-docker-images.sh popd
Note
|
The OPENNMS_BUILD environment variable is used by the copy-rpms.sh script to find the .rpms.
|
Note
|
You can also use the OPENNMS_RPM_ROOT environment variable to point to the directory containing RPMs for the copy-rpms.sh script.
|
When developing tests you can disable the automatic tear down of the containers after the test using:
@ClassRule
public static MinionSystem minionSystem = MinionSystem.builder().skipTearDown(true).build();
You can also run the tests against an existing environment using:
@ClassRule
public static MinionSystem minionSystem = MinionSystem.builder().useExisting(true).build();
If you want to destroy an existing environment you can kill and remove ALL of your containers using:
docker kill $(docker ps -q) docker rm $(docker ps -a -q)