summaryrefslogtreecommitdiffstats
path: root/tests/geo-rep.rc
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-09-14 03:42:26 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2018-09-21 13:25:43 +0000
commite50a6ee2c913b5b4df53f0efca4de66c5262d1e1 (patch)
treea949c7c9241bd5beedeb3d0ee0478e2af77b4b63 /tests/geo-rep.rc
parent72514f20d2ae947529cd1c4b4b009f27bae7032a (diff)
geo-rep: Fix issues related config set
1. '--ignore-mising-args' option for rsync is not being used even though the rsync version is greater than 3.1.0. Fixed the same. 2. '--existing' option for rsync is also not being used. Fixed the same. 3. geo-rep config fails to set rsync-options as the value contains '--'. Interestingly, python argsparse treats the value with '--' (e.g., --ignore-missing-args) as option. But when passed with something like --value=--ignore-missing-args, it succeeds. Fixed the same. Backport of: > Patch: https://review.gluster.org/21191 > Change-Id: Iaeb838acaff1c2920fee9c7f920c99edce13a0a1 > Signed-off-by: Kotresh HR <khiremat@redhat.com> > BUG: 1629561 Change-Id: Iaeb838acaff1c2920fee9c7f920c99edce13a0a1 Signed-off-by: Kotresh HR <khiremat@redhat.com> fixes: bz#1630140
Diffstat (limited to 'tests/geo-rep.rc')
-rw-r--r--tests/geo-rep.rc188
1 files changed, 153 insertions, 35 deletions
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
index 8c5391dbfa9..c33ceaaa64e 100644
--- a/tests/geo-rep.rc
+++ b/tests/geo-rep.rc
@@ -1,4 +1,4 @@
-GEO_REP_TIMEOUT=60
+GEO_REP_TIMEOUT=120
function check_status_num_rows()
{
@@ -43,7 +43,7 @@ function create_data()
# dir
mkdir ${master_mnt}/${prefix}_d1
mkdir ${master_mnt}/${prefix}_d2
- touch ${master_mnt}/${prefix}_d3
+ mkdir ${master_mnt}/${prefix}_d3
# Hardlink
ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1
@@ -102,17 +102,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
}
@@ -123,8 +126,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
@@ -144,38 +146,62 @@ 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()
+function rename_file_ok()
{
old_name=$1
new_name=$2
- if [ -f $old_name ]
- then
+ if [ -f $old_name ]; then
+ echo 1
+ elif [ ! -f $new_name ]; then
echo 1
+ else
+ echo 0
fi
+}
- if [ ! -f $new_name ]
- then
+function rename_dir_ok()
+{
+ old_name=$1
+ new_name=$2
+
+ if [ -d $old_name ]; then
+ echo 1
+ elif [ ! -d $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
@@ -224,9 +250,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()
@@ -234,16 +261,107 @@ 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 create_symlink_rename_mkdir_data()
+{
+ mkdir ${master_mnt}/symlink_test1
+ touch ${master_mnt}/symlink_test1/file1
+ ln -s "./file1" ${master_mnt}/symlink_test1/sym_link
+ mv ${master_mnt}/symlink_test1/sym_link ${master_mnt}/symlink_test1/rn_sym_link
+ mkdir ${master_mnt}/symlink_test1/sym_link
+}
+function verify_symlink_rename_mkdir_data()
+{
+ 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
+}
+
+function create_rsnapshot_data()
+{
+ rm -rf /tmp/rsnapshot_symlinkbug
+ mkdir /tmp/rsnapshot_symlinkbug
+ ln -f -s /does/not/exist /tmp/rsnapshot_symlinkbug/a_symlink
+ rsync -a /tmp/rsnapshot_symlinkbug ${master_mnt}/
+ cp -al ${master_mnt}/rsnapshot_symlinkbug ${master_mnt}/rsnapshot_symlinkbug.0
+ ln -f -s /does/not/exist2 /tmp/rsnapshot_symlinkbug/a_symlink
+ rsync -a /tmp/rsnapshot_symlinkbug ${master_mnt}/
+ cp -al ${master_mnt}/rsnapshot_symlinkbug ${master_mnt}/rsnapshot_symlinkbug.1
+}
+
+function verify_rsnapshot_data()
+{
+ dir="$1/rsnapshot_symlinkbug"
+ dir0="$1/rsnapshot_symlinkbug.0"
+ dir1="$1/rsnapshot_symlinkbug.1"
+ if [ ! -d "$dir" ]; then
+ echo 1
+ elif [ ! -h $dir/a_symlink ]; then
+ echo 1
+ elif test "X$(readlink $dir/a_symlink)" != "X/does/not/exist2"; then
+ echo 1
+ elif [ ! -h $dir0/a_symlink ]; then
+ echo 1
+ elif test "X$(readlink $dir0/a_symlink)" != "X/does/not/exist"; then
+ echo 1
+ elif [ ! -h $dir1/a_symlink ]; then
+ echo 1
+ elif test "X$(readlink $dir1/a_symlink)" != "X/does/not/exist2"; then
+ echo 1
+ else
+ echo 0
+ fi
+}
+
+function create_hardlink_rename_data()
+{
+ dir=${master_mnt}/hardlink_rename_issue
+ mkdir $dir
+ echo "test_data" > $dir/f1
+ ln $dir/f1 $dir/f2
+ mv $dir/f2 $dir/f3
+ unlink $dir/f1
+}
+
+function verify_hardlink_rename_data()
+{
+ dir=$1/hardlink_rename_issue
+ if [ ! -d $dir ]; then
+ echo 1
+ elif [ -f $dir/f1 ]; then
+ echo 1
+ elif [ -f $dir/f2 ]; then
+ echo 1
+ elif [ ! -f $dir/f3 ]; then
+ echo 1
+ elif test "Xtest_data" != "X$(cat $dir/f3)"; then
+ echo 1
+ else
+ echo 0
fi
- echo 0
}