summaryrefslogtreecommitdiffstats
path: root/tests/tier.rc
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2015-11-03 21:07:00 +0530
committerDan Lambright <dlambrig@redhat.com>2015-11-03 10:44:29 -0800
commit081e7938c8711aa7ce8a2955bb34767b697cf8b9 (patch)
tree4370ee9e4a52a74ce4d5706b22f6f4929effc0f2 /tests/tier.rc
parentc8f0d11918cc7d3577d624f2d757dc975c8bfad7 (diff)
tests/tier: Move common functions to tier.rc
Move common functions in tier .t files to tier.rc > Change-Id: Ibc312d987be9d93e7cc7fc47d0bf598bb1c944c2 > Signed-off-by: N Balachandran <nbalacha@redhat.com> > Reviewed-on: http://review.gluster.org/12404 > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Dan Lambright <dlambrig@redhat.com> > Tested-by: Dan Lambright <dlambrig@redhat.com> (cherry picked from commit 594a03b030577bf0ed6960199e920cc5fa7e7afc) Change-Id: Ie13bb86f85575164e62120e29bbbedb7789b0af5 BUG: 1277590 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: http://review.gluster.org/12497 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'tests/tier.rc')
-rw-r--r--tests/tier.rc85
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/tier.rc b/tests/tier.rc
new file mode 100644
index 00000000000..393d712f3bb
--- /dev/null
+++ b/tests/tier.rc
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Common tier functions
+
+# Check if a file is being migrated
+# by checking for the presence of
+# the sticky bit
+# Args: $1 : path to file
+
+function is_sticky_set () {
+ echo $1
+ if [ -k $1 ];
+ then
+ echo "yes"
+ else
+ echo "no"
+ fi
+}
+
+
+function check_counters {
+ index=0
+ ret=0
+ rm -f /tmp/tc*.txt
+ echo "0" > /tmp/tc2.txt
+ $CLI volume rebalance $V0 tier status | grep localhost > /tmp/tc.txt
+
+ promote=`cat /tmp/tc.txt |awk '{print $2}'`
+ demote=`cat /tmp/tc.txt |awk '{print $3}'`
+ if [ "${promote}" != "${1}" ]; then
+ echo "1" > /tmp/tc2.txt
+
+ elif [ "${demote}" != "${2}" ]; then
+ echo "2" > /tmp/tc2.txt
+ fi
+
+ # temporarily disable non-Linux tests.
+ case $OSTYPE in
+ NetBSD | FreeBSD | Darwin)
+ echo "0" > /tmp/tc2.txt
+ ;;
+ esac
+ cat /tmp/tc2.txt
+}
+
+
+# Grab md5sum without file path (failed attempt notifications are discarded)
+function fingerprint {
+ md5sum $1 2> /dev/null | grep --only-matching -m 1 '^[0-9a-f]*'
+}
+
+
+
+# Create a large number of files in the current directory.
+# $1 : file name prefix. Will create files $2-1 to $2-$3
+# $2 : number of files
+
+function create_many_files {
+ filename=$1
+ num=$2
+
+ for i in `seq 1 $num`; do
+ dd if=/dev/urandom of=./${dirname}/${filename}$i bs=104857 count=1;
+ done
+}
+
+
+function confirm_tier_removed {
+ $CLI system getspec $V0 | grep $1
+ if [ $? == 0 ]; then
+ echo "1"
+ else
+ echo "0"
+ fi
+}
+
+function confirm_vol_stopped {
+ $CLI volume stop $1
+ if [ $? == 0 ]; then
+ echo "0"
+ else
+ echo "1"
+ fi
+}
+