Skip to content
Snippets Groups Projects
Commit 69a04e00 authored by MJB's avatar MJB
Browse files

#44 removed old rspec files, updated the readme and removed ffmpeg as it was not testing anything

parent 5eeabdc8
No related branches found
No related tags found
No related merge requests found
...@@ -37,71 +37,59 @@ ...@@ -37,71 +37,59 @@
#### Documentation #### Documentation
Implementation documentation and discussion can be found in the [FLAME CLMC Information Model Specification](docs/clmc-information-model.md) Implementation documentation and discussion can be found in the docs directory.
#### Development Environment
The development environment is currently Vagrant/Virtualbox providing the infrastructure for dev and testing.
Vagrant-disksize plugin must be installed.
`vagrant plugin install vagrant-disksize`
#### Testing #### Testing
Testing is implemented using pytest using the following convention: 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 * Tests are written in python using pytest
* Related tests are stored in a python module `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 * 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
* Each test module has a rspec.yml that provides the baseline "fixture" for the tests in the module * Tests are executed against a set of LXC containers described in `src/test/clmctest/rspec.json`.
* Tests are executed against fixtures. Fixtures are modular "setups" created for a test, that are inserted into the python code using dependancy injection. This offers more flexibility than the unit style testing. The baseline deployment is created using `vagrant up` with an appropriate rspec, and the pytest fixture reads the rspec.yml and makes the configuration available to the test. * Tests are executed from the test-runner container on the VM using install python modules
* Tests are executed from a guest VM (not the host) in the repo root using the command `pytest test/<testmodule>`
* Pytest will scan the directory for all tests including in files test_*.py and run them
#### Creating a deployment for a test
Each test has a fixture defining a set of VMs required for the test. The fixture is described in an rspec.yml file that is stored within the clmctest/<testmoduel> directory. For example, the monitoring test fixture is stored in the following file.
`clmctest\monitoring\rspec.yml`
The fixture is created by running the vagrant up command with the test module name as a parameter
`vagrant --fixture=monitoring -- up`
This will provision the following VMs clmc-service, ipendpoint1, ipendpoint2
The **clmc-service** vm includes influx, Kapacitor and Chronograf. The following ports forwarded to the clmc VM from the host machine are as follows:
* Influx: 8086 Here's the instructions
* Chronograf: 8888
* Kapacitor: 9092
Typically, tests are run from a test-runner VM that has pytest installed. The script used to install pytest is `vagrant up`
`clmctest/services/pytest/install.sh` This will create a single VM with LXC installed and configured with lxcbr0 configured for the network 172.40.231.0/24
To run a test, SSH into the test runner machine SSH into the VM
`vagrant --fixture=monitoring -- ssh test-runner` `vagrant ssh`
Then go to the 'vagrant' directory. Create the services needed for integration tests
`cd /vagrant` `/vagrant/scripts/test/conts-create.sh`
Run the pytest. All of the containers created are defined in the file `/vagrant/src/test/clmctest/rspec.json`
`pytest -s clmctest/monitoring/` Attach to the test-runner
#### Tests run from the host `lxc-attach -n test-runner`
Tests can be run from the host by sshing commands to the test running. This is described in the .gitlab-ci.yml file. The file shows how a python package is created Here we need to define a make file but for now the commands are manual
`python setup.py sdist --dist-dir=build` ```
cd /vagrant/src/test
python setup.py sdist --dist-dir=../../build
cd ../../src/service
python setup.py sdist --dist-dir=../../build
pip3 install /vagrant/build/clmctest-SNAPSHOT.tar.gz
pip3 install /vagrant/build/clmcservice-SNAPSHOT.tar.gz
```
Then the package is installed The following modules are unit tests
`vagrant --fixture=scripts -- ssh test-runner -- -tt "pip3 install /vagrant/build/clmctest-SNAPSHOT.tar.gz"` ```
pytest -s --pyargs clmctest.scripts
pytest -s --pyargs clmcservice.tests
```
Then the tests are run The following modules are integration tests
`vagrant --fixture=scripts -- ssh test-runner -- -tt "pytest -s --pyargs clmctest.scripts"` ```
pytest -s --pyargs clmctest.monitoring
pytest -s --pyargs clmctest.inputs
```
#!/bin/bash #!/bin/bash
set -eu -o pipefail set -eu -o pipefail
cd `dirname $0`
source conts-env.sh source conts-env.sh
......
#!/bin/bash #!/bin/bash
set -eu -o pipefail set -eu -o pipefail
cd `dirname $0`
source conts-env.sh source conts-env.sh
......
#!/bin/bash #!/bin/bash
set -eu -o pipefail set -eu -o pipefail
cd `dirname $0`
source conts-env.sh source conts-env.sh
......
#!/bin/bash #!/bin/bash
set -eu -o pipefail set -eu -o pipefail
cd `dirname $0`
source conts-env.sh source conts-env.sh
......
## (c) University of Southampton IT Innovation Centre, 2018
##
## Copyright in this software belongs to University of Southampton
## IT Innovation Centre of Gamma House, Enterprise Road,
## Chilworth Science Park, Southampton, SO16 7NS, UK.
##
## This software may not be used, sold, licensed, transferred, copied
## or reproduced in whole or in part in any manner or form or in or
## on any media by any person other than in accordance with the terms
## of the Licence Agreement supplied with the software, or otherwise
## without the prior written consent of the copyright owners.
##
## This software is distributed WITHOUT ANY WARRANTY, without even the
## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE, except where stated in the Licence Agreement supplied with
## the software.
##
## Created By : Michael Boniface
## Created Date : 02-02-2018
## Created for Project : FLAME
hosts:
- name: clmc-service
cpus: 1
memory: 2048
disk: "10GB"
forward_ports:
- guest: 8086
host: 8086
- guest: 8888
host: 8888
- guest: 9092
host: 9092
ip_address: "172.40.231.51"
- name: minio
service_name: "minio"
cpus: 1
memory: 2048
disk: "10GB"
forward_ports:
- guest: 9000
host: 9000
ip_address: "172.40.231.155"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "adaptive_streaming"
sf_id_instance: "adaptive_streaming_I1"
ipendpoint_id: "adaptive_streaming_I1_minio"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: test-runner
cpus: 1
memory: 2048
disk: "10GB"
ip_address: "172.40.231.200"
## (c) University of Southampton IT Innovation Centre, 2018
##
## Copyright in this software belongs to University of Southampton
## IT Innovation Centre of Gamma House, Enterprise Road,
## Chilworth Science Park, Southampton, SO16 7NS, UK.
##
## This software may not be used, sold, licensed, transferred, copied
## or reproduced in whole or in part in any manner or form or in or
## on any media by any person other than in accordance with the terms
## of the Licence Agreement supplied with the software, or otherwise
## without the prior written consent of the copyright owners.
##
## This software is distributed WITHOUT ANY WARRANTY, without even the
## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE, except where stated in the Licence Agreement supplied with
## the software.
##
## Created By : Michael Boniface
## Created Date : 02-02-2018
## Created for Project : FLAME
hosts:
- name: clmc-service
cpus: 1
memory: 2048
disk: "10GB"
forward_ports:
- guest: 8086
host: 8086
- guest: 8888
host: 8888
- guest: 9092
host: 9092
ip_address: "172.40.231.51"
- name: apache
cpus: 1
memory: 2048
disk: "10GB"
service_name: "apache"
forward_ports:
- guest: 80
host: 8881
ip_address: "172.40.231.150"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "adaptive_streaming"
sf_id_instance: "adaptive_streaming_I1"
ipendpoint_id: "adaptive_streaming_I1_apache1"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: nginx
cpus: 1
memory: 2048
disk: "10GB"
service_name: "nginx"
forward_ports:
- guest: 80
host: 8882
ip_address: "172.40.231.151"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "adaptive_streaming"
sf_id_instance: "adaptive_streaming_nginx_I1"
ipendpoint_id: "adaptive_streaming_nginx_I1_apache1"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: mongo
cpus: 1
memory: 2048
disk: "10GB"
service_name: "mongo"
forward_ports:
- guest: 80
host: 8883
ip_address: "172.40.231.152"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "metadata_database"
sf_id_instance: "metadata_database_I1"
ipendpoint_id: "metadata_database_I1_apache1"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: ffmpeg
cpus: 1
memory: 2048
disk: "10GB"
service_name: "ffmpeg"
forward_ports:
- guest: 80
host: 8884
ip_address: "172.40.231.153"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "metadata_database"
sf_id_instance: "metadata_database_I1"
ipendpoint_id: "metadata_database_I1_apache1"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: host
cpus: 1
memory: 2048
disk: "10GB"
service_name: "host"
forward_ports:
- guest: 80
host: 8885
ip_address: "172.40.231.154"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "adaptive_streaming"
sf_id_instance: "adaptive_streaming_I1"
ipendpoint_id: "adaptive_streaming_I1_apache1"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: test-runner
cpus: 2
memory: 4096
disk: "10GB"
ip_address: "172.40.231.200"
- name: minio
service_name: "minio"
cpus: 1
memory: 2048
disk: "10GB"
forward_ports:
- guest: 9000
host: 9000
ip_address: "172.40.231.155"
location: "DC1"
sfc_id: "MS_Template_1"
sfc_id_instance: "MS_I1"
sf_id: "adaptive_streaming"
sf_id_instance: "adaptive_streaming_I1"
ipendpoint_id: "adaptive_streaming_I1_minio"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
\ No newline at end of file
...@@ -32,7 +32,6 @@ import pytest ...@@ -32,7 +32,6 @@ import pytest
'apache', 'apache',
'nginx', 'nginx',
'mongo', 'mongo',
'ffmpeg',
'host', 'host',
'minio' 'minio'
]) ])
......
...@@ -32,7 +32,6 @@ from influxdb import InfluxDBClient ...@@ -32,7 +32,6 @@ from influxdb import InfluxDBClient
('apache'), ('apache'),
('nginx'), ('nginx'),
('mongo'), ('mongo'),
('ffmpeg'),
('host'), ('host'),
('minio') ('minio')
]) ])
......
## (c) University of Southampton IT Innovation Centre, 2018
##
## Copyright in this software belongs to University of Southampton
## IT Innovation Centre of Gamma House, Enterprise Road,
## Chilworth Science Park, Southampton, SO16 7NS, UK.
##
## This software may not be used, sold, licensed, transferred, copied
## or reproduced in whole or in part in any manner or form or in or
## on any media by any person other than in accordance with the terms
## of the Licence Agreement supplied with the software, or otherwise
## without the prior written consent of the copyright owners.
##
## This software is distributed WITHOUT ANY WARRANTY, without even the
## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE, except where stated in the Licence Agreement supplied with
## the software.
##
## Created By : Michael Boniface
## Created Date : 02-02-2018
## Created for Project : FLAME
hosts:
- name: clmc-service
cpus: 1
memory: 2048
disk: "10GB"
forward_ports:
- guest: 8086
host: 8086
- guest: 8888
host: 8888
- guest: 9092
host: 9092
- guest: 9080
host: 9080
ip_address: "172.40.231.51"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
report_period: 25
- name: ipendpoint1
cpus: 1
memory: 2048
disk: "10GB"
service_name: "ipendpoint"
forward_ports:
- guest: 80
host: 8081
ip_address: "172.40.231.170"
location: "nova"
sfc_id: "media_service_A"
sfc_id_instance: "StackID"
sf_id: "test-sf-clmc-agent-build"
sf_id_instance: "ms-A.ict-flame.eu"
ipendpoint_id: "endpoint1.ms-A.ict-flame.eu"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: ipendpoint2
cpus: 1
memory: 2048
disk: "10GB"
service_name: "ipendpoint"
forward_ports:
- guest: 80
host: 8082
ip_address: "172.40.231.171"
location: "nova"
sfc_id: "media_service_A"
sfc_id_instance: "StackID"
sf_id: "test-sf-clmc-agent-build"
sf_id_instance: "ms-A.ict-flame.eu"
ipendpoint_id: "endpoint2.ms-A.ict-flame.eu"
sr_id: "service_router"
influxdb_url: "http://172.40.231.51:8086"
database_name: "CLMCMetrics"
- name: test-runner
cpus: 1
memory: 2048
disk: "10GB"
ip_address: "172.40.231.200"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment