From 9183617ec4833b905a0a9c5a2fb7fc4852a3719a Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Tue, 9 Oct 2018 19:54:52 +0100
Subject: [PATCH] fixing fixtures so that it is consitent with openstack
 deployment

---
 scripts/test/fixture.sh | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/scripts/test/fixture.sh b/scripts/test/fixture.sh
index 872f89a..51eae2c 100755
--- a/scripts/test/fixture.sh
+++ b/scripts/test/fixture.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 repo_root="/vagrant"
+target_root="/opt/clmc"
 config_file="rspec.json"
 
 usage() {
@@ -31,7 +32,7 @@ create() {
         # copy flame clmc files into the root container
         echo "Copying files to rootfs"
         container_dir="/var/lib/lxd/containers/"${service_name}"/rootfs"
-        container_repo_root=${container_dir}"/opt/clmc"
+        container_repo_root=${container_dir}${target_root}
         mkdir -p ${container_repo_root}       
         cp -f ${repo_root}/reporc ${container_repo_root}   
         cp -rf ${repo_root}/scripts ${container_repo_root}     
@@ -50,9 +51,9 @@ create() {
         # provision software into each container
         echo "Provisioning: ${service_name}"
         if [ ${service_name} == "clmc-service" ]; then
-            cmd="/opt/clmc/scripts/clmc-service/install.sh"
+            cmd="${target_root}/clmc/scripts/clmc-service/install.sh"
             echo "Provisioning command ${cmd}"
-            lxc exec ${service_name} --env REPO_ROOT="/opt/clmc" --env SFEMC_FQDN="sfemc.localhost" -- ${cmd}
+            lxc exec ${service_name} --env REPO_ROOT=${target_root} --env SFEMC_FQDN="sfemc.localhost" -- ${cmd}
             exit_code=$?
             if [ $exit_code != 0 ]; then
                 echo "clmc-service installation failed with exit code ${exit_code}"
@@ -60,7 +61,7 @@ create() {
             fi            
         elif [ ${service_name} == "test-runner" ]
         then
-            cmd=/vagrant/src/test/clmctest/services/pytest/install.sh
+            cmd="${target_root}/src/test/clmctest/services/pytest/install.sh"
             lxc exec ${service_name} -- ${cmd}
             exit_code=$?
             if [ $exit_code != 0 ]; then
@@ -78,16 +79,16 @@ create() {
             influxdb_url=$(echo $SERVICE | jq -r '.influxdb_url')
 
             # install service function specific software
-            cmd=/vagrant/src/test/clmctest/services/${sf_package_id}/install.sh
-            lxc exec ${service_name} --env REPO_ROOT="/vagrant" -- ${cmd}
+            cmd="${target_root}/src/test/clmctest/services/${sf_package_id}/install.sh"
+            lxc exec ${service_name} --env REPO_ROOT="${target_root}" -- ${cmd}
             exit_code=$?
             if [ $exit_code != 0 ]; then
                 echo "${sf_package_id} installation failed with exit code ${exit_code}"
                 exit 1
             fi
             # install telegraf
-            cmd=/vagrant/scripts/clmc-agent/install.sh
-            lxc exec ${service_name} --env REPO_ROOT="/vagrant" -- /vagrant/scripts/clmc-agent/install.sh
+            cmd="${target_root}/scripts/clmc-agent/install.sh"
+            lxc exec ${service_name} --env REPO_ROOT="${target_root}" -- ${cmd}
 
             # check that telegraf installed (it may not have if the reporc file was not present or Nexus server was down)
             if lxc-attach -n ${service_name} -- ls /etc/telegraf |& grep 'ls: cannot access'; then
@@ -108,7 +109,7 @@ create() {
             chown -R 100000:100000 ${container_dir}/etc/telegraf/
 
             # replace telegraf template with container parameters
-            cmd="/vagrant/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_instance_id} ${sf_package_id} ${sf_id} ${sf_endpoint_id} ${influxdb_url}"
+            cmd="${target_root}/scripts/clmc-agent/configure.sh ${location} ${sfc_id} ${sfc_instance_id} ${sf_package_id} ${sf_id} ${sf_endpoint_id} ${influxdb_url}"
             lxc exec ${service_name} -- ${cmd}
 
             # start telegraf
-- 
GitLab