summaryrefslogtreecommitdiffstats
path: root/integration
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-08-02 11:24:27 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2017-08-08 09:15:44 +0800
commitc420248ac1daed625ab0d05d1a663c877426701a (patch)
tree107f5a3b23b0061f3d56b98d4400de75a1c25074 /integration
parentf708300052c2315994ba16793972ce0dfbfa237e (diff)
Fix bug in running storperf.sh when WORKSPACE is defined
When working directory changes, the script and default configuration will not be found. Change-Id: Iab6e4f9b014c12a863498de42553b043357aa876 Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'integration')
-rw-r--r--integration/storperf/default_job.json6
-rwxr-xr-xintegration/storperf/start_job.sh7
-rwxr-xr-xintegration/storperf/storperf.sh18
3 files changed, 18 insertions, 13 deletions
diff --git a/integration/storperf/default_job.json b/integration/storperf/default_job.json
index dd42dcee..d0e1516d 100644
--- a/integration/storperf/default_job.json
+++ b/integration/storperf/default_job.json
@@ -1,9 +1,9 @@
{
"block_sizes": "1024",
"deadline": 30,
- "steady_state_samples": 10,
+ "steady_state_samples": 2,
"queue_depths": "1",
- "workload": "wr,rr,rw",
+ "workload": "rw",
"metadata": {
"disk_type": "HDD",
"scenario_name": "none",
@@ -12,4 +12,4 @@
"build_tag": "",
"test_case": "snia_steady_state"
}
-} \ No newline at end of file
+}
diff --git a/integration/storperf/start_job.sh b/integration/storperf/start_job.sh
index 363072f6..e94356e5 100755
--- a/integration/storperf/start_job.sh
+++ b/integration/storperf/start_job.sh
@@ -26,11 +26,14 @@ while getopts ":s:j:he" optchar; do
esac
done
+# See https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
if [[ -z $WORKSPACE ]];then
WORKSPACE=`pwd`
fi
-source $WORKSPACE/openstack.sh
+source $script_dir/openstack.sh
echo ==========================================================================
echo "Start to create storperf stack"
@@ -65,7 +68,7 @@ else
JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2`
while [ "$JOB_STATUS" != "Completed" ]
do
- sleep 300
+ sleep 30
mv $WORKSPACE/status.json $WORKSPACE/old-status.json
curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
-o $WORKSPACE/status.json
diff --git a/integration/storperf/storperf.sh b/integration/storperf/storperf.sh
index 8120cb90..31e059d7 100755
--- a/integration/storperf/storperf.sh
+++ b/integration/storperf/storperf.sh
@@ -28,6 +28,9 @@ while getopts ":t:i:s:j:he" optchar; do
esac
done
+# See https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
+script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
if [[ -z $WORKSPACE ]];then
WORKSPACE=`pwd`
fi
@@ -35,11 +38,11 @@ fi
#set vars from env if not provided by user as options
installer_type=${installer_type:-$INSTALLER_TYPE}
installer_ip=${installer_ip:-$INSTALLER_IP}
-stack_json=${stack_json:-"$WORKSPACE/default_stack.json"}
-job_json=${job_json:-"$WORKSPACE/default_job.json"}
+stack_json=${stack_json:-"$script_dir/default_stack.json"}
+job_json=${job_json:-"$script_dir/default_job.json"}
-source $WORKSPACE/openstack.sh
-source $WORKSPACE/storperf_docker.sh
+source $script_dir/openstack.sh
+source $script_dir/storperf_docker.sh
git clone --depth 1 https://gerrit.opnfv.org/gerrit/storperf $WORKSPACE/storperf
git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng
@@ -47,7 +50,7 @@ git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng
virtualenv $WORKSPACE/storperf_venv
source $WORKSPACE/storperf_venv/bin/activate
-pip install -r ./storperf_requirements.txt
+pip install -r $script_dir/storperf_requirements.txt
$WORKSPACE/releng/utils/fetch_os_creds.sh -i ${installer_type} -a ${installer_ip} -d $WORKSPACE/openrc
source $WORKSPACE/openrc
@@ -67,14 +70,13 @@ load_ubuntu_image
create_storperf_flavor
cd $WORKSPACE/storperf/docker
-cp $WORKSPACE/storperf-docker-compose.yaml ./
+cp $script_dir/storperf-docker-compose.yaml ./
echo "Clean existing storperf containers"
clean_storperf_container
echo "Launch new storperf containers"
launch_storperf_container
-cd $WORKSPACE
-./start_job.sh -s $stack_json -j $job_json
+$script_dir/start_job.sh -s $stack_json -j $job_json
echo "Clean up environment"
cd $WORKSPACE/storperf/docker