FLAME Cross Layer Management and Control
Version: 1.0.0
About this document
Authors
Authors | Organisation |
---|---|
Michael Boniface | University of Southampton, IT Innovation Centre |
Simon Crowle | University of Southampton, IT Innovation Centre |
Contents
Documentation
Implementation documentation and discussion can be found in the docs directory.
Testing
Testing is implemented using pytest using the following convention:
- The testing environment is Vagrant/Virtualbox for a base VM with LXC is installed for specific containers.
- Tests are written in python using pytest
- Related tests are stored in a python module
src/test/clmctest/<testmodule>
to create a suite of tests. All tests are stored in files test_*.py, there can be many tests per file, and many files per module - Tests are executed against a set of LXC containers described in
src/test/clmctest/rspec.json
. - Tests are executed from the test-runner container on the VM using install python modules
Create a single VM with LXC installed and configured with lxcbr0 configured for the network 172.40.231.0/24
vagrant up
SSH into the VM:
vagrant ssh
The containers are controlled using a script called /vagrant/scripts/test/fixtures.sh
Usage: fixture.sh create|start|stop|destroy [-f config_file] [-r repo_root] [-c container_name|all]
The containers created are defined an rspec.json file, there's an example here: /vagrant/src/test/clmctest/rspec.json
. The fixtures.sh
script defaults to look for a rspec.json
in the current directory, you can specify a specific rspec.json
file using the -f
option.
To create|start|stop|destroy specific services use the -c
option e.g.
/vagrant/scripts/test/fixture.sh create -f /vagrant/src/test/clmctest/rspec.json -c clmc-service
The installation of several of the services depend on accessing the Nexus binary repository (for the custom Telegraf agent). To do this, a username and password for the repository must be specified in a reporc
file in the user's home directory, e.g.
REPO_USER=itinnov.flame.integration
REPO_PASS=xxxxxxx
Create all the services needed for integration tests:
sudo su
/vagrant/scripts/test/fixture.sh create -f /vagrant/src/test/clmctest/rspec.json -c all
As part of the clmc-service installation, the service's unit tests have been run. The fixture script will fail if any individual service installation fails to install (or fails its tests).
Attach to the test-runner to run the tests
lxc-attach -n test-runner
Build and install the CLMC test Python module:
cd /vagrant/src/test
python setup.py sdist --dist-dir=../../build
pip3 install /vagrant/build/clmctest-SNAPSHOT.tar.gz
The following module is unit tests:
pytest -s --pyargs clmctest.scripts
The following modules are integration tests:
pytest -s --pyargs clmctest.inputs
pytest -s --pyargs clmctest.monitoring
CI Testing
A vagrant VM is setup on givry in the directory /home/mjb/flame-clmc
The VM is started using a libvirt vagrant file through the following command:
VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant up
The VM has gitlab-runner installed:
VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant up
VAGRANT_VAGRANTFILE=Vagrantfile.libvirt vagrant ssh -- -tt "sudo /vagrant/scripts/test/install-git-runner.sh"
Runners can be installed on a developer's virtualbox VM if necessary, in that case you can just use:
vagrant up
vagrant ssh -- -tt "sudo /vagrant/scripts/test/install-git-runner.sh"
N.B. libvirt takes the VM name from the name of the folder containing the vagrantfile. To make sure that libvirt doesn't try to reuse an existing VM machine name, checkout the flame-clmc project into an alternative directory name such as flame-clmc-username
.