Skip to content
Snippets Groups Projects
Commit 31fb2f77 authored by MJB's avatar MJB
Browse files

Merge branch 'integration' into mediaComponentConfig

parents c69b67fa 3cbd9020
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 18 deletions
File moved
......@@ -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
......@@ -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.
......
File moved
File moved
File moved
File moved
File moved
File moved
File moved
......@@ -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
File moved
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