summaryrefslogtreecommitdiffstats
path: root/tests/geo-rep.rc
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-06-27 08:26:44 -0400
committerNigel Babu <nigelb@redhat.com>2018-07-02 06:09:10 +0000
commit957e2963cfd960caa49edc0e6aba738167b33ec5 (patch)
treee47ce2db4ced72ba271722363ec468d4feaab905 /tests/geo-rep.rc
parentb3c2116d99a5c049e4ee0f88f35440258b49496e (diff)
tests/geo-rep: Add symlink rename test case
Added a test case of symlink rename and directory creation with the name same as original symlink file. Also fixed few other issues in geo-rep.rc fixes: bz#1595726 Change-Id: I8e6acd3e742f3a0104cd37b87d1c0e0c902679b5 Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'tests/geo-rep.rc')
-rw-r--r--tests/geo-rep.rc100
1 files changed, 66 insertions, 34 deletions
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
index a1dfaf8104b..51c63b3a07a 100644
--- a/tests/geo-rep.rc
+++ b/tests/geo-rep.rc
@@ -92,17 +92,20 @@ function hardlink_file_ok()
orig_inode=$(stat --format "%i" "$orig_file")
rc=$?
- if test $rc != 0; then echo $rc; fi
-
- link_inode=$(stat --format "%i" "$link_file")
- rc=$?
- if test $rc != 0; then echo $rc; fi
-
- if test $orig_inode != $link_inode
- then
- echo 1
+ if test $rc != 0; then
+ echo $rc
else
- echo 0
+ link_inode=$(stat --format "%i" "$link_file")
+ rc=$?
+ if test $rc != 0; then
+ echo $rc
+ else
+ if test $orig_inode != $link_inode; then
+ echo 1
+ else
+ echo 0
+ fi
+ fi
fi
}
@@ -113,8 +116,7 @@ function data_ok()
data2=$(cat $path)
echo "data1:$data1"
echo "data2:$data2"
- if test "X$data1" != "X$data2"
- then
+ if test "X$data1" != "X$data2"; then
echo 1
else
echo 0
@@ -134,10 +136,17 @@ function symlink_ok()
local symlink_file=$2
local file_type=$(stat --format "%F" "$symlink_file")
- if test "X$file_type" != "Xsymbolic link"; then echo 1;else echo 0; fi
+ if test "X$file_type" != "Xsymbolic link"; then
+ echo 1
+ else
+ local fname=$(readlink $symlink_file)
+ if test "X$fname" != "X$orig_file_name"; then
+ echo 1
+ else
+ echo 0
+ fi
+ fi
- local fname=$(readlink $symlink_file)
- if test "X$fname" != "X$orig_file_name"; then echo 1;else echo 0; fi
}
function rename_ok()
@@ -145,27 +154,30 @@ function rename_ok()
old_name=$1
new_name=$2
- if [ -f $old_name ]
- then
+ if [ -f $old_name ]; then
echo 1
- fi
-
- if [ ! -f $new_name ]
- then
+ elif [ ! -f $new_name ]; then
echo 1
+ else
+ echo 0
fi
- echo 0
}
function create_georep_session()
{
$CLI system:: execute gsec_create
rc=$?
- if test $rc != 0; then echo $rc; fi
- $CLI volume geo-rep $master $slave create push-pem
- rc=$?
- if test $rc != 0; then echo $rc; fi
- echo 0
+ if test $rc != 0; then
+ echo $rc
+ else
+ $CLI volume geo-rep $master $slave create push-pem
+ rc=$?
+ if test $rc != 0; then
+ echo $rc
+ else
+ echo 0
+ fi
+ fi
}
# logrotate_simulate should be called (rotate_count + 1) times to cause
@@ -214,9 +226,10 @@ function create_rename_ok()
# to be recreated i.e. a dangling entry without a corresponding
# back-end gfid link should not exist on the slave
if [ -f "$file_name" ]; then
- echo 1
+ echo 1
+ else
+ echo 0
fi
- echo 0
}
function hardlink_rename()
@@ -224,16 +237,35 @@ function hardlink_rename()
file_name=$1
echo $file_name > $file_name
ln $file_name $file_name.hl
- mv $file_name.hl $file_name
+ mv $file_name.hl $file_name.hl1
}
function hardlink_rename_ok()
{
file_name=$1
# the hardlink file should not exist on the slave after renaming
- # to one of its links
- if [ -f "$file_name.hl" ]; then
- echo 1
+ # to one of its links on changelog reprocessing
+ if [ ! -f "$file_name" ]; then
+ echo 1
+ elif [ ! -f "$file_name.hl1" ]; then
+ echo 1
+ elif [ -f "$file_name.hl" ]; then
+ echo 1
+ else
+ echo 0
+ fi
+}
+
+function symlink_rename_mkdir_ok()
+{
+ sym_dir=$1
+ if [ ! -f $sym_dir/file1 ]; then
+ echo 1
+ elif [ ! -h $sym_dir/rn_sym_link ]; then
+ echo 1
+ elif [ ! -d $sym_dir/sym_link ]; then
+ echo 1
+ else
+ echo 0
fi
- echo 0
}