diff --git a/.gitattributes b/.gitattributes index 3717e43ef0423d7a71be063dbffea321469df977..2244894dcc56019add4c4be65ad674158dccf045 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,4 +5,6 @@ scripts/* text eol=lf # Denote all files that are truly binary and should not be modified. *.png binary -*.jpg binary \ No newline at end of file +*.jpg binary +*.build-config/ +*.pytest_cache/ \ No newline at end of file diff --git a/.githooks/post-commit b/.githooks/post-commit new file mode 100644 index 0000000000000000000000000000000000000000..fffb01be78319dd66c2bf1f1c1c956d94c4ec232 --- /dev/null +++ b/.githooks/post-commit @@ -0,0 +1,4 @@ +#!/bin/bash +mkdir .build-config +git rev-list --count integration > .build-config/git-commit-count +git describe --all --long > .build-config/git-commit-version \ No newline at end of file diff --git a/.gitignore b/.gitignore index 07e683d3972836af2d108f67b090eaa53a5eaf08..3606f48ab501a0bb12774f0c27851fc23e18d82e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -/src/clmc-spec/clmc-spec/nbproject/ -/src/clmc-spec/nbproject/ -/src/clmc-spec/target/ .vagrant/ .log +*__pycache__* +*__init__.pyc +*egg-info* ubuntu-xenial-16.04-cloudimg-console.log \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9f551e467d6594125b92330309a149f58e3e7d0..b86c40851ab293ed5830ed70f34a513fc0fcc476 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ stages: - test:scripts - - test:streaming_sim - - test:telegraf_agents + - test:monitoring + - test:inputs test:scripts: stage: test:scripts @@ -9,31 +9,31 @@ test:scripts: - vagrant --fixture=scripts -- destroy --force script: - vagrant --fixture=scripts -- up - - vagrant --fixture=scripts -- ssh test-runner -- -tt "cd /vagrant && pytest test/scripts/" + - vagrant --fixture=scripts -- ssh test-runner -- -tt "cd /vagrant && pytest clmctest/scripts/" after_script: - vagrant --fixture=scripts -- destroy --force when: manual -test:streaming_sim: +test:monitoring: stage: test:streaming_sim before_script: - - vagrant --fixture=streaming-sim -- destroy --force + - vagrant --fixture=monitoring -- destroy --force script: - - vagrant --fixture=streaming-sim -- up - - vagrant --fixture=streaming-sim -- ssh test-runner -- -tt "cd /vagrant && pytest test/streaming-sim/" + - vagrant --fixture=monitoring -- up + - vagrant --fixture=monitoring -- ssh test-runner -- -tt "cd /vagrant && pytest clmctest/monitoring/" after_script: - - vagrant --fixture=streaming-sim -- destroy --force + - vagrant --fixture=monitoring -- destroy --force when: manual -test:telegraf_agents: - stage: test:telegraf_agents +test:inputs: + stage: test:inputs before_script: - - vagrant --fixture=telegraf-agents -- destroy --force + - vagrant --fixture=inputs -- destroy --force script: - - vagrant --fixture=telegraf-agents -- up - - vagrant --fixture=telegraf-agents -- ssh test-runner -- -tt "cd /vagrant && pytest test/telegraf-agents/" + - vagrant --fixture=inputs -- up + - vagrant --fixture=inputs -- ssh test-runner -- -tt "cd /vagrant && pytest clmctest/inputs/" after_script: - - vagrant --fixture=telegraf-agents -- destroy --force + - vagrant --fixture=inputs -- destroy --force when: manual diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000000000000000000000000000000000..993dbd0acf646a37d2568ce5ab0b8dad4df6ba40 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include MANIFEST.in +recursive-include clmctest *.yml *.sh \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile index c5a42fe47ab9a6545276968f824d881ff295113d..47524d810802f3645e4d3c754121685030dcf66c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -48,8 +48,8 @@ end # load custom config file puts "loading custom infrastructure configuration: #{fixture}" -puts "custom config file: /test/#{fixture}/rspec.yml" -host_rspec_file = "test/#{fixture}/rspec.yml" +puts "custom config file: /clmctest/#{fixture}/rspec.yml" +host_rspec_file = "clmctest/#{fixture}/rspec.yml" hosts = YAML.load_file(host_rspec_file) # Start creating VMS using xenial64 as the base box @@ -89,21 +89,29 @@ Vagrant.configure("2") do |config| puts "Instance name #{instance_name}:" case instance_name when 'test-runner' - instance_config.vm.provision :shell, :path => "test/services/pytest/install.sh" + instance_config.vm.provision :shell, :path => "clmctest/services/pytest/install.sh" when 'clmc-service' instance_config.vm.provision :shell, :path => "scripts/clmc-service/install.sh" else # specific service install - instance_config.vm.provision :shell, :path => "test/services/#{host["service_name"]}/install.sh", env: {"REPO_ROOT" => "/vagrant"} + instance_config.vm.provision :shell, :path => "clmctest/services/#{host["service_name"]}/install.sh", env: {"REPO_ROOT" => "/vagrant"} # CLMC agent install instance_config.vm.provision :shell, :path => "scripts/clmc-agent/install.sh" # CLMC agent service specific input configuration - instance_config.vm.provision :shell, inline: "cp /vagrant/test/services/#{host["service_name"]}/telegraf_#{host["service_name"]}.conf /etc/telegraf/telegraf.d/" + instance_config.vm.provision :shell, inline: <<-SHELL + cp /vagrant/scripts/clmc-agent/telegraf.conf /etc/telegraf/ + + cp /vagrant/scripts/clmc-agent/telegraf_output.conf /etc/telegraf/telegraf.d/ + + cp /vagrant/clmctest/services/#{host["service_name"]}/telegraf_#{host["service_name"]}.conf /etc/telegraf/telegraf.d/ + + SHELL + # CLMC agent general and output configuration - instance_config.vm.provision :shell, :path => "scripts/clmc-agent/configure_template.sh" + #instance_config.vm.provision :shell, :path => "scripts/clmc-agent/configure_template.sh" instance_config.vm.provision :shell, :path => "scripts/clmc-agent/configure.sh", :args => "#{host["location"]} #{host["sfc_id"]} #{host["sfc_id_instance"]} #{host["sf_id"]} #{host["sf_id_instance"]} #{host["ipendpoint_id"]} #{host["influxdb_url"]} #{host["database_name"]}" diff --git a/test/__init__.py b/clmctest/__init__.py similarity index 100% rename from test/__init__.py rename to clmctest/__init__.py diff --git a/test/streaming-sim/__init__.py b/clmctest/inputs/__init__.py similarity index 100% rename from test/streaming-sim/__init__.py rename to clmctest/inputs/__init__.py diff --git a/test/telegraf-agents/conftest.py b/clmctest/inputs/conftest.py similarity index 81% rename from test/telegraf-agents/conftest.py rename to clmctest/inputs/conftest.py index b096dd4d6875bed42e3c2842148c7b2f6db7a32d..0a1be8ff018d05e38bc15cd0edf3543ea322c825 100644 --- a/test/telegraf-agents/conftest.py +++ b/clmctest/inputs/conftest.py @@ -2,10 +2,11 @@ import pytest import yaml +import pkg_resources from influxdb import InfluxDBClient -@pytest.fixture(scope="module", params=[{'config': {'rspec': 'test/telegraf-agents/rspec.yml'}}]) +@pytest.fixture(scope="module") def telegraf_agent_config(request): """ Reads the service configuration deployed for the streaming simulation test. @@ -13,8 +14,9 @@ def telegraf_agent_config(request): :param request: access the parameters of the fixture :return: the python object representing the read YAML file """ - - with open(request.param['config']['rspec'], 'r') as stream: + rspec = pkg_resources.resource_filename('clmctest.inputs', 'rspec.yml') + print("rspec file: {0}".format(rspec)) + with open(rspec, 'r') as stream: data_loaded = yaml.load(stream) return data_loaded diff --git a/test/telegraf-agents/rspec.yml b/clmctest/inputs/rspec.yml similarity index 82% rename from test/telegraf-agents/rspec.yml rename to clmctest/inputs/rspec.yml index 6dad4be08d89d3f1bcc31e65e92e909c591d14fd..b64c1462cf39d7a156ee28f218d08ffb596d5430 100644 --- a/test/telegraf-agents/rspec.yml +++ b/clmctest/inputs/rspec.yml @@ -10,7 +10,7 @@ hosts: host: 8888 - guest: 9092 host: 9092 - ip_address: "192.168.50.10" + ip_address: "203.0.113.100" - name: apache cpus: 1 memory: 2048 @@ -19,14 +19,14 @@ hosts: forward_ports: - guest: 80 host: 8881 - ip_address: "192.168.50.11" + ip_address: "203.0.113.101" 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" - influxdb_url: "http://192.168.50.10:8086" + influxdb_url: "http://203.0.113.100:8086" database_name: "CLMCMetrics" - name: nginx cpus: 1 @@ -36,14 +36,14 @@ hosts: forward_ports: - guest: 80 host: 8082 - ip_address: "192.168.50.13" + ip_address: "203.0.113.102" 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" - influxdb_url: "http://192.168.50.10:8086" + influxdb_url: "http://203.0.113.100:8086" database_name: "CLMCMetrics" - name: mongo cpus: 1 @@ -53,14 +53,14 @@ hosts: forward_ports: - guest: 80 host: 8083 - ip_address: "192.168.50.14" + ip_address: "203.0.113.103" 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" - influxdb_url: "http://192.168.50.10:8086" + influxdb_url: "http://203.0.113.100:8086" database_name: "CLMCMetrics" - name: ffmpeg cpus: 1 @@ -70,14 +70,14 @@ hosts: forward_ports: - guest: 80 host: 8084 - ip_address: "192.168.50.15" + ip_address: "203.0.113.104" 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" - influxdb_url: "http://192.168.50.10:8086" + influxdb_url: "http://203.0.113.100:8086" database_name: "CLMCMetrics" - name: host cpus: 1 @@ -87,17 +87,17 @@ hosts: forward_ports: - guest: 80 host: 8085 - ip_address: "192.168.50.16" + ip_address: "203.0.113.105" 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" - influxdb_url: "http://192.168.50.10:8086" + influxdb_url: "http://203.0.113.100:8086" database_name: "CLMCMetrics" - name: test-runner cpus: 1 memory: 2048 disk: "10GB" - ip_address: "192.168.50.17" \ No newline at end of file + ip_address: "203.0.113.150" \ No newline at end of file diff --git a/test/telegraf-agents/test_rspec.py b/clmctest/inputs/test_rspec.py similarity index 100% rename from test/telegraf-agents/test_rspec.py rename to clmctest/inputs/test_rspec.py diff --git a/test/telegraf-agents/test_telegraf_agents.py b/clmctest/inputs/test_telegraf_agents.py similarity index 100% rename from test/telegraf-agents/test_telegraf_agents.py rename to clmctest/inputs/test_telegraf_agents.py diff --git a/test/streaming-sim/LineProtocolGenerator.py b/clmctest/monitoring/LineProtocolGenerator.py similarity index 100% rename from test/streaming-sim/LineProtocolGenerator.py rename to clmctest/monitoring/LineProtocolGenerator.py diff --git a/test/streaming-sim/StreamingSim.py b/clmctest/monitoring/StreamingSim.py similarity index 99% rename from test/streaming-sim/StreamingSim.py rename to clmctest/monitoring/StreamingSim.py index 4ddde6c804aaa56db3863b79e21063d0b8f157cc..afc1f24e084bd4cff1f13de3514c5fa87b263cc5 100644 --- a/test/streaming-sim/StreamingSim.py +++ b/clmctest/monitoring/StreamingSim.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -import LineProtocolGenerator as lp +import clmctest.monitoring.LineProtocolGenerator as lp import time import urllib.parse import pytest diff --git a/test/streaming/__init__.py b/clmctest/monitoring/__init__.py similarity index 100% rename from test/streaming/__init__.py rename to clmctest/monitoring/__init__.py diff --git a/test/streaming-sim/conftest.py b/clmctest/monitoring/conftest.py similarity index 78% rename from test/streaming-sim/conftest.py rename to clmctest/monitoring/conftest.py index a1b0c145cc890a2e3dca9a2bcca1ac954f8d55d5..828b68c5be2051469b5d5c4c5d52f2b08236cf05 100644 --- a/test/streaming-sim/conftest.py +++ b/clmctest/monitoring/conftest.py @@ -2,19 +2,22 @@ import pytest import yaml +import pkg_resources from influxdb import InfluxDBClient -@pytest.fixture(scope="module", params=[{'config': {'rspec': 'test/streaming-sim/rspec.yml'}}]) -def streaming_sim_config(request): +@pytest.fixture(scope="module") +def streaming_sim_config(): """ Reads the service configuration deployed for the streaming simulation test. :param request: access the parameters of the fixture :return: the python object representing the read YAML file """ + rspec = pkg_resources.resource_filename('clmctest.monitoring', 'rspec.yml') + print("rspec file: {0}".format(rspec)) - with open(request.param['config']['rspec'], 'r') as stream: + with open(rspec, 'r') as stream: data_loaded = yaml.load(stream) return data_loaded @@ -30,3 +33,4 @@ def get_db_client(streaming_sim_config, request): """ return InfluxDBClient(host=streaming_sim_config['hosts'][0]['ip_address'], port=8086, database=request.param['database'], timeout=10) + diff --git a/test/streaming-sim/rspec.yml b/clmctest/monitoring/rspec.yml similarity index 92% rename from test/streaming-sim/rspec.yml rename to clmctest/monitoring/rspec.yml index 97967dc66fda80f75d1bdbcd5a0013ed0dc446c8..03bb6d746208d1bfec28dbeda791242d5c54cbe0 100644 --- a/test/streaming-sim/rspec.yml +++ b/clmctest/monitoring/rspec.yml @@ -19,7 +19,7 @@ hosts: forward_ports: - guest: 80 host: 8081 - ip_address: "203.0.113.101" + ip_address: "203.0.113.140" location: "DC1" sfc_id: "MS_Template_1" sfc_id_instance: "MS_I1" @@ -36,7 +36,7 @@ hosts: forward_ports: - guest: 80 host: 8082 - ip_address: "203.0.113.102" + ip_address: "203.0.113.141" location: "DC2" sfc_id: "MS_Template_1" sfc_id_instance: "MS_I1" @@ -49,4 +49,4 @@ hosts: cpus: 1 memory: 2048 disk: "10GB" - ip_address: "203.0.113.102" \ No newline at end of file + ip_address: "203.0.113.150" \ No newline at end of file diff --git a/test/streaming-sim/test_rspec.py b/clmctest/monitoring/test_rspec.py similarity index 100% rename from test/streaming-sim/test_rspec.py rename to clmctest/monitoring/test_rspec.py diff --git a/test/streaming-sim/test_simresults.py b/clmctest/monitoring/test_simresults.py similarity index 97% rename from test/streaming-sim/test_simresults.py rename to clmctest/monitoring/test_simresults.py index ffdd8a949b2cbb7408fe40e3fbcbc8d2fa04d3b1..7940fc3a3bc1c97d49d36aedb07cdbb2fcd44ff2 100644 --- a/test/streaming-sim/test_simresults.py +++ b/clmctest/monitoring/test_simresults.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import pytest -from StreamingSim import run_simulation_fixture +from clmctest.monitoring.StreamingSim import run_simulation_fixture class TestSimulation(object): diff --git a/clmctest/scripts/.pytest_cache/v/cache/lastfailed b/clmctest/scripts/.pytest_cache/v/cache/lastfailed new file mode 100644 index 0000000000000000000000000000000000000000..a120e0d9a98eab3d93b1e1878f1ea7a5aa9de13f --- /dev/null +++ b/clmctest/scripts/.pytest_cache/v/cache/lastfailed @@ -0,0 +1,3 @@ +{ + "test_config_telegraf.py::test_write_telegraf_conf": true +} \ No newline at end of file diff --git a/test/telegraf-agents/__init__.py b/clmctest/scripts/__init__.py similarity index 100% rename from test/telegraf-agents/__init__.py rename to clmctest/scripts/__init__.py diff --git a/test/scripts/rspec.yml b/clmctest/scripts/rspec.yml similarity index 71% rename from test/scripts/rspec.yml rename to clmctest/scripts/rspec.yml index f69ab5dfa503ced367ea50eb53bd1ca871669772..17f1d315febe35757fdddd21a9286861b2263cfa 100644 --- a/test/scripts/rspec.yml +++ b/clmctest/scripts/rspec.yml @@ -3,5 +3,5 @@ hosts: cpus: 1 memory: 2048 disk: "10GB" - ip_address: "192.168.50.10" + ip_address: "200.0.113.150" \ No newline at end of file diff --git a/test/scripts/test_config_telegraf.py b/clmctest/scripts/test_config_telegraf.py similarity index 79% rename from test/scripts/test_config_telegraf.py rename to clmctest/scripts/test_config_telegraf.py index c1d9393044663560aabbe26f5c63c6a42b7488f9..2ae71b896942b6d3db600a077ab4caad6ca37050 100644 --- a/test/scripts/test_config_telegraf.py +++ b/clmctest/scripts/test_config_telegraf.py @@ -17,24 +17,21 @@ def test_write_telegraf_conf(): DATABASE_NAME="experimentation_database" try: - # run write config template script with no telegraf conf directory - cmd = 'sudo /vagrant/scripts/clmc-agent/configure_template.sh' - (out, err, code) = run_command(cmd) - assert code == 1, "Failed to catch error of no telegraf configuration directory : " + str(code) + ", cmd=" + cmd - # mk telegraf conf directory - run_command("sudo mkdir -p /etc/telegraf") - # run write config template script with no telegraf.d directory - (out, err, code) = run_command(cmd) - assert code == 1, "Failed to catch error of no telegraf include directory : " + str(code) + ", cmd=" + cmd + (out, err, code) = run_command('sudo mkdir -p /etc/telegraf') + assert code == 0, "Failed to create telegraf conf dir : " + str(code) + ", cmd=" + cmd - # mk telegraf.d directory - run_command("sudo mkdir -p /etc/telegraf/telegraf.d") + (out, err, code) = run_command('sudo mkdir -p /etc/telegraf/telegraf.d') + assert code == 0, "Failed to create telegraf include dir : " + str(code) + ", cmd=" + cmd - # run write config template script and check that the script has exited correctly + # run write config template script with no telegraf.d directory + (out, err, code) = run_command('sudo cp /vagrant/scripts/clmc-agent/telegraf.conf /etc/telegraf/') + assert code == 0, "Failed to copy telegraf.conf : " + str(code) + ", cmd=" + cmd + + cmd = 'sudo cp /vagrant/scripts/clmc-agent/telegraf_output.conf /etc/telegraf/telegraf.d/' (out, err, code) = run_command(cmd) - assert code == 0, "Failed to write configuration files : " + str(code) + ", cmd=" + cmd + assert code == 0, "Failed to copy telegraf_output.conf : " + str(code) + ", cmd=" + cmd # run template relacement script with incorrect arguments cmd = 'sudo /vagrant/scripts/clmc-agent/configure.sh' @@ -72,9 +69,8 @@ def test_write_telegraf_conf(): finally: # clean up telegraf after test - run_command("sudo rm -rf /etc/telegraf") - print ("finally") - +# run_command("sudo rm -rf /etc/telegraf") + print("final") # wrapper for executing commands on the cli, returning (std_out, std_error, process_return_code) def run_command(cmd): """Run a shell command. diff --git a/test/services/apache/install.sh b/clmctest/services/apache/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/apache/install.sh rename to clmctest/services/apache/install.sh diff --git a/test/services/apache/telegraf_apache.conf b/clmctest/services/apache/telegraf_apache.conf similarity index 100% rename from test/services/apache/telegraf_apache.conf rename to clmctest/services/apache/telegraf_apache.conf diff --git a/test/services/ffmpeg/install.sh b/clmctest/services/ffmpeg/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/ffmpeg/install.sh rename to clmctest/services/ffmpeg/install.sh diff --git a/test/services/ffmpeg/telegraf_ffmpeg.conf b/clmctest/services/ffmpeg/telegraf_ffmpeg.conf similarity index 100% rename from test/services/ffmpeg/telegraf_ffmpeg.conf rename to clmctest/services/ffmpeg/telegraf_ffmpeg.conf diff --git a/test/services/ffmpeg/transcode.sh b/clmctest/services/ffmpeg/transcode.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/ffmpeg/transcode.sh rename to clmctest/services/ffmpeg/transcode.sh diff --git a/test/services/host/install.sh b/clmctest/services/host/install.sh similarity index 100% rename from test/services/host/install.sh rename to clmctest/services/host/install.sh diff --git a/test/services/host/telegraf_host.conf b/clmctest/services/host/telegraf_host.conf similarity index 100% rename from test/services/host/telegraf_host.conf rename to clmctest/services/host/telegraf_host.conf diff --git a/test/services/ipendpoint/install.sh b/clmctest/services/ipendpoint/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/ipendpoint/install.sh rename to clmctest/services/ipendpoint/install.sh diff --git a/test/services/ipendpoint/telegraf_ipendpoint.conf b/clmctest/services/ipendpoint/telegraf_ipendpoint.conf similarity index 100% rename from test/services/ipendpoint/telegraf_ipendpoint.conf rename to clmctest/services/ipendpoint/telegraf_ipendpoint.conf diff --git a/test/services/loadtest-streaming/install.sh b/clmctest/services/loadtest-streaming/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/loadtest-streaming/install.sh rename to clmctest/services/loadtest-streaming/install.sh diff --git a/test/services/loadtest-streaming/telegraf_loadtest_streaming.conf b/clmctest/services/loadtest-streaming/telegraf_loadtest_streaming.conf similarity index 100% rename from test/services/loadtest-streaming/telegraf_loadtest_streaming.conf rename to clmctest/services/loadtest-streaming/telegraf_loadtest_streaming.conf diff --git a/test/services/mongo/install.sh b/clmctest/services/mongo/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/mongo/install.sh rename to clmctest/services/mongo/install.sh diff --git a/test/services/mongo/telegraf_mongo.conf b/clmctest/services/mongo/telegraf_mongo.conf similarity index 100% rename from test/services/mongo/telegraf_mongo.conf rename to clmctest/services/mongo/telegraf_mongo.conf diff --git a/test/services/nginx/install.sh b/clmctest/services/nginx/install.sh old mode 100755 new mode 100644 similarity index 72% rename from test/services/nginx/install.sh rename to clmctest/services/nginx/install.sh index fa0b75253e50c3b0486a6067b1b4f0d0cd68bcc1..d8baa4697ca7c3089e2cf14436440f26c7e578c3 --- a/test/services/nginx/install.sh +++ b/clmctest/services/nginx/install.sh @@ -30,6 +30,23 @@ yes Y | apt-get install nginx # Need to set up basic stats as this not configured by default # http://nginx.org/en/docs/http/ngx_http_stub_status_module.html -cp -rf $REPO_ROOT/test/services/nginx/nginx.conf /etc/nginx/nginx.conf + +NGINX_CONF_SOURCE=$REPO_ROOT"/clmctest/services/nginx/nginx.conf" +NGINX_CONF_TARGET="/etc/nginx/nginx.conf" + +# Check the target telegraf directory exists +if [ ! -f "$NGINX_CONF_SOURCE" ]; then + echo "Error: NGINX conf file does not exist on in the repo. "$NGINX_CONF_SOURCE + exit 1 +fi + +cp -rf $NGINX_CONF_SOURCE $NGINX_CONF_TARGET + +# Check the target telegraf directory exists +if [ ! -f "$NGINX_CONF_TARGET" ]; then + echo "Error: NGINX conf copy failed to target machine. "$NGINX_CONF_TARGET + exit 1 +fi + nginx -s reload systemctl start nginx \ No newline at end of file diff --git a/test/services/nginx/nginx.conf b/clmctest/services/nginx/nginx.conf similarity index 100% rename from test/services/nginx/nginx.conf rename to clmctest/services/nginx/nginx.conf diff --git a/test/services/nginx/telegraf_nginx.conf b/clmctest/services/nginx/telegraf_nginx.conf similarity index 100% rename from test/services/nginx/telegraf_nginx.conf rename to clmctest/services/nginx/telegraf_nginx.conf diff --git a/test/services/pytest/install.sh b/clmctest/services/pytest/install.sh similarity index 100% rename from test/services/pytest/install.sh rename to clmctest/services/pytest/install.sh diff --git a/test/services/vlc/install.sh b/clmctest/services/vlc/install.sh old mode 100755 new mode 100644 similarity index 100% rename from test/services/vlc/install.sh rename to clmctest/services/vlc/install.sh diff --git a/clmctest/streaming/__init__.py b/clmctest/streaming/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..44f772595799f5fe338534918c95e23e08e80464 --- /dev/null +++ b/clmctest/streaming/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/python3 \ No newline at end of file diff --git a/test/streaming/conftest.py b/clmctest/streaming/conftest.py similarity index 58% rename from test/streaming/conftest.py rename to clmctest/streaming/conftest.py index 77e0f1d2d5f50a2a13d7918d24b155563a377436..8aa64e50f91b5dda288d9fb05a8241320b36b46c 100644 --- a/test/streaming/conftest.py +++ b/clmctest/streaming/conftest.py @@ -2,17 +2,19 @@ import pytest import yaml +import pkg_resources - -@pytest.fixture(scope="module", params=[{'config': {'rspec': '/vagrant/test/streaming/rspec.yml'}}]) -def streaming_config(request): +@pytest.fixture(scope="module") +def streaming_config(): """ Reads the service configuration deployed for the streaming simulation test. :param request: access the parameters of the fixture :return: the python object representing the read YAML file """ + rspec = pkg_resources.resource_filename('clmctest.streaming', 'rspec.yml') + print("rspec file: {0}".format(rspec)) - with open(request.param['config']['rspec'], 'r') as stream: + with open(rspec, 'r') as stream: data_loaded = yaml.load(stream) return data_loaded diff --git a/test/streaming/dashboard.json b/clmctest/streaming/dashboard.json similarity index 100% rename from test/streaming/dashboard.json rename to clmctest/streaming/dashboard.json diff --git a/test/streaming/influx.json b/clmctest/streaming/influx.json similarity index 100% rename from test/streaming/influx.json rename to clmctest/streaming/influx.json diff --git a/test/streaming/kapacitor.conf b/clmctest/streaming/kapacitor.conf similarity index 100% rename from test/streaming/kapacitor.conf rename to clmctest/streaming/kapacitor.conf diff --git a/test/streaming/kapacitor.json b/clmctest/streaming/kapacitor.json similarity index 100% rename from test/streaming/kapacitor.json rename to clmctest/streaming/kapacitor.json diff --git a/test/streaming/manual.md b/clmctest/streaming/manual.md similarity index 100% rename from test/streaming/manual.md rename to clmctest/streaming/manual.md diff --git a/test/streaming/report.sh b/clmctest/streaming/report.sh similarity index 100% rename from test/streaming/report.sh rename to clmctest/streaming/report.sh diff --git a/test/streaming/rspec.yml b/clmctest/streaming/rspec.yml similarity index 100% rename from test/streaming/rspec.yml rename to clmctest/streaming/rspec.yml diff --git a/test/streaming/rules.json b/clmctest/streaming/rules.json similarity index 100% rename from test/streaming/rules.json rename to clmctest/streaming/rules.json diff --git a/test/streaming/run.sh b/clmctest/streaming/run.sh old mode 100755 new mode 100644 similarity index 100% rename from test/streaming/run.sh rename to clmctest/streaming/run.sh diff --git a/test/streaming/setupCLMC.sh b/clmctest/streaming/setupCLMC.sh similarity index 100% rename from test/streaming/setupCLMC.sh rename to clmctest/streaming/setupCLMC.sh diff --git a/test/streaming/setupNGINX.sh b/clmctest/streaming/setupNGINX.sh similarity index 100% rename from test/streaming/setupNGINX.sh rename to clmctest/streaming/setupNGINX.sh diff --git a/test/streaming/stop.sh b/clmctest/streaming/stop.sh old mode 100755 new mode 100644 similarity index 100% rename from test/streaming/stop.sh rename to clmctest/streaming/stop.sh diff --git a/test/streaming/test_rspec.py b/clmctest/streaming/test_rspec.py similarity index 100% rename from test/streaming/test_rspec.py rename to clmctest/streaming/test_rspec.py diff --git a/test/streaming/test_streaming.py b/clmctest/streaming/test_streaming.py similarity index 100% rename from test/streaming/test_streaming.py rename to clmctest/streaming/test_streaming.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..7eb4dc603a0e6bef515aabd74442eab2f690111d --- /dev/null +++ b/setup.py @@ -0,0 +1,26 @@ +import os +from setuptools import setup, find_packages + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +setup( + name = "clmctest", + #version = read('.build-config/git-commit-version'), + version = "SNAPSHOT", + author = "Michael Boniface", + author_email = "mjb@it-innovation.soton.ac.uk", + description = "FLAME CLMC Testing Module", + license = "license", + keywords = "example documentation", + url = "http://packages.python.org/an_example_pypi_project", + packages=find_packages(exclude=["services"]), + include_package_data=True, + package_data={'': ['*.yml', '*.sh']}, + long_description="long description", + classifiers=[ + "Development Status :: Alpha", + "Topic :: FLAME Tests", + "License :: ", + ], +) \ No newline at end of file