From 82a755f683b17204b84e0b5966e87e2007a48421 Mon Sep 17 00:00:00 2001 From: Delia Popescu Date: Tue, 29 May 2018 11:46:37 +0300 Subject: Update read and write data path in cinder test Update the path for read/write data Fix a false possitive result on read_data Fix read device name Unmount volume after writing data JIRA: FUNCTEST-908 Change-Id: I555b5a3daaeff3aa58891e65c0b70094372c04c9 Signed-off-by: Delia Popescu --- functest/opnfv_tests/openstack/cinder/read_data.sh | 16 +++++++++------- functest/opnfv_tests/openstack/cinder/write_data.sh | 17 +++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'functest/opnfv_tests/openstack/cinder') diff --git a/functest/opnfv_tests/openstack/cinder/read_data.sh b/functest/opnfv_tests/openstack/cinder/read_data.sh index 90758436d..c3ce9e4f7 100644 --- a/functest/opnfv_tests/openstack/cinder/read_data.sh +++ b/functest/opnfv_tests/openstack/cinder/read_data.sh @@ -8,14 +8,16 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -VOL_DEV_NAME="$(lsblk -l | grep -Po '^[vs]dc\W')" +DEST=$(mktemp -d) +VOL_DEV_NAME="$(lsblk -l -o NAME | grep -o "vdc\|sdc\b")" +echo "VOL_DEV_NAME: $VOL_DEV_NAME" -if [ -n "$VOL_DEV_NAME" ]; then - sudo mount /dev/$VOL_DEV_NAME /home/cirros/volume; - if [ -f /home/cirros/volume/new_data ]; then - echo "Found existing data!"; +if [ ! -z $VOL_DEV_NAME ]; then + sudo mount /dev/$VOL_DEV_NAME $DEST + if [ -f $DEST/new_data ]; then + echo "Found new data!" else - echo "No data found on the volume!"; - exit 1 + echo "Failed to find data!" + exit 1 fi fi diff --git a/functest/opnfv_tests/openstack/cinder/write_data.sh b/functest/opnfv_tests/openstack/cinder/write_data.sh index eeafbb54a..70f8275f1 100644 --- a/functest/opnfv_tests/openstack/cinder/write_data.sh +++ b/functest/opnfv_tests/openstack/cinder/write_data.sh @@ -8,14 +8,19 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -VOL_DEV_NAME="$(lsblk -l | grep -Po '^[vs]dc\W')" +DEST=$(mktemp -d) +VOL_DEV_NAME="$(lsblk -l -o NAME | grep -o "vdc\|sdc\b")" -if [ -n $VOL_DEV_NAME ]; then - sudo mkdir -p /home/cirros/volume +echo "VOL_DEV_NAME: $VOL_DEV_NAME" + +if [ ! -z $VOL_DEV_NAME ]; then sudo /usr/sbin/mkfs.ext4 -F /dev/$VOL_DEV_NAME - sudo mount /dev/$VOL_DEV_NAME /home/cirros/volume - sudo touch /home/cirros/volume/new_data - echo "New data added to the volume!" + sudo mount /dev/$VOL_DEV_NAME $DEST + sudo touch $DEST/new_data + if [ -f $DEST/new_data ]; then + echo "New data added to the volume!" + sudo umount $DEST + fi else echo "Failed to write data!" exit 1 -- cgit 1.2.3-korg