summaryrefslogtreecommitdiffstats
path: root/tests/geo-rep.rc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/geo-rep.rc')
-rw-r--r--tests/geo-rep.rc164
1 files changed, 146 insertions, 18 deletions
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
index c33ceaaa64e..9ba4262730e 100644
--- a/tests/geo-rep.rc
+++ b/tests/geo-rep.rc
@@ -1,4 +1,9 @@
GEO_REP_TIMEOUT=120
+CHECK_MOUNT_TIMEOUT=50
+#check for mount point
+function check_mounted () {
+ df | grep $1 | wc -l
+}
function check_status_num_rows()
{
@@ -6,6 +11,37 @@ function check_status_num_rows()
$GEOREP_CLI $master $slave status | grep -F "$search_key" | wc -l
}
+function check_fanout_status_num_rows()
+{
+ local search_key=$1
+ $GEOREP_CLI $master status | grep -F "$search_key" | wc -l
+}
+
+function check_fanout_status_detail_num_rows()
+{
+ local search_key=$1
+ $GEOREP_CLI $master status detail | grep -F "$search_key" | wc -l
+}
+
+function check_all_status_num_rows()
+{
+ local search_key=$1
+ $GEOREP_CLI status | grep -F "$search_key" | wc -l
+}
+
+function check_all_status_detail_num_rows()
+{
+ local search_key=$1
+ $GEOREP_CLI status detail | grep -F "$search_key" | wc -l
+}
+
+function verify_checkpoint_met()
+{
+ local master=$1
+ local slave=$2
+ $GEOREP_CLI $master $slave status detail| grep -F "Yes" | wc -l
+}
+
function check_keys_distributed()
{
local search_key=$(cat /var/lib/glusterd/geo-replication/master_slave_common_secret.pem.pub)
@@ -19,6 +55,18 @@ function check_common_secret_file()
echo $?
}
+function create_rename_symlink_case()
+{
+ mkdir ${mastermnt}/MUL_REN_SYMLINK
+ cd ${mastermnt}/MUL_REN_SYMLINK
+ mkdir sym_dir1
+ ln -s "sym_dir1" sym1
+ mv sym1 sym2
+ mv sym2 sym3
+ mv sym3 sym4
+ cd -
+}
+
function create_data()
{
prefix=$1
@@ -40,34 +88,70 @@ function create_data()
touch ${master_mnt}/${prefix}_f2
touch ${master_mnt}/${prefix}_f3
+ # non-ascii filename test
+ echo "Hello non-ascii" > ${master_mnt}/${prefix}_f1_ಸಂತಸ
+ touch ${master_mnt}/${prefix}_f2_ಸಂತಸ
+ touch ${master_mnt}/${prefix}_f3_ಸಂತಸ
+
# dir
mkdir ${master_mnt}/${prefix}_d1
mkdir ${master_mnt}/${prefix}_d2
mkdir ${master_mnt}/${prefix}_d3
- # Hardlink
+ # non-ascii dir and filename test
+ mkdir ${master_mnt}/${prefix}_d1_ನನ್ನ
+ mkdir ${master_mnt}/${prefix}_d2_ಸಂತಸ
+ mkdir ${master_mnt}/${prefix}_d3_ಸಂತಸ
+ echo "Hello non-ascii" > ${master_mnt}/${prefix}_d1_ನನ್ನ/ಸಂತಸ
+
+ # Hardlink + non-ascii name
ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1
+ ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1_ಸಂತಸ
# Symlink
cd ${master_mnt}
ln -s ${prefix}_f1 ${prefix}_sl1
+ ln -s ${prefix}_f1 ${prefix}_sl1_ಸಂತಸ
cd -
# UNLINK
rm ${master_mnt}/${prefix}_f2
+ rm ${master_mnt}/${prefix}_f2_ಸಂತಸ
# RMDIR
rmdir ${master_mnt}/${prefix}_d2
+ rmdir ${master_mnt}/${prefix}_d2_ಸಂತಸ
# Rename - File
mv ${master_mnt}/${prefix}_f3 ${master_mnt}/${prefix}_f4
+ mv ${master_mnt}/${prefix}_f3_ಸಂತಸ ${master_mnt}/${prefix}_f4_ಸಂತಸ
# Rename - Dir
mv ${master_mnt}/${prefix}_d3 ${master_mnt}/${prefix}_d4
+ mv ${master_mnt}/${prefix}_d3_ಸಂತಸ ${master_mnt}/${prefix}_d4_ಸಂತಸ
# chown
touch ${master_mnt}/${prefix}_chown_f1
chown 1000:1000 ${master_mnt}/${prefix}_chown_f1
+ touch ${master_mnt}/${prefix}_chown_f1_ಸಂತಸ
+ chown 1000:1000 ${master_mnt}/${prefix}_chown_f1_ಸಂತಸ
+}
+
+function create_data_hang()
+{
+ prefix=$1
+ mkdir ${master_mnt}/${prefix}
+ cd ${master_mnt}/${prefix}
+ # ~1k files is required with 1 sync-job and hang happens if
+ # stderr buffer of tar/ssh executed with Popen is full (i.e., 64k).
+ # 64k is hit when ~800 files were not found while syncing data
+ # from master. So around 1k files is required to hit the condition.
+ for i in {1..1000}
+ do
+ echo "test data" > file$i
+ mv -f file$i file
+ done
+ cd -
}
function chown_file_ok()
@@ -137,7 +221,8 @@ function arequal_checksum()
{
master=$1
slave=$2
- diff <(arequal-checksum -p $master) <(arequal-checksum -p $slave) | wc -l
+ ret=$(diff <(arequal-checksum -p $master) <(arequal-checksum -p $slave) | wc -l)
+ echo x$ret
}
function symlink_ok()
@@ -151,7 +236,7 @@ function symlink_ok()
else
local fname=$(readlink $symlink_file)
if test "X$fname" != "X$orig_file_name"; then
- echo 1
+ echo 2
else
echo 0
fi
@@ -167,7 +252,7 @@ function rename_file_ok()
if [ -f $old_name ]; then
echo 1
elif [ ! -f $new_name ]; then
- echo 1
+ echo 2
else
echo 0
fi
@@ -181,7 +266,7 @@ function rename_dir_ok()
if [ -d $old_name ]; then
echo 1
elif [ ! -d $new_name ]; then
- echo 1
+ echo 2
else
echo 0
fi
@@ -272,9 +357,9 @@ function hardlink_rename_ok()
if [ ! -f "$file_name" ]; then
echo 1
elif [ ! -f "$file_name.hl1" ]; then
- echo 1
+ echo 2
elif [ -f "$file_name.hl" ]; then
- echo 1
+ echo 3
else
echo 0
fi
@@ -294,9 +379,9 @@ function verify_symlink_rename_mkdir_data()
if [ ! -f $sym_dir/file1 ]; then
echo 1
elif [ ! -h $sym_dir/rn_sym_link ]; then
- echo 1
+ echo 2
elif [ ! -d $sym_dir/sym_link ]; then
- echo 1
+ echo 3
else
echo 0
fi
@@ -322,17 +407,17 @@ function verify_rsnapshot_data()
if [ ! -d "$dir" ]; then
echo 1
elif [ ! -h $dir/a_symlink ]; then
- echo 1
+ echo 2
elif test "X$(readlink $dir/a_symlink)" != "X/does/not/exist2"; then
- echo 1
+ echo 3
elif [ ! -h $dir0/a_symlink ]; then
- echo 1
+ echo 4
elif test "X$(readlink $dir0/a_symlink)" != "X/does/not/exist"; then
- echo 1
+ echo 5
elif [ ! -h $dir1/a_symlink ]; then
- echo 1
+ echo 6
elif test "X$(readlink $dir1/a_symlink)" != "X/does/not/exist2"; then
- echo 1
+ echo 7
else
echo 0
fi
@@ -354,13 +439,56 @@ function verify_hardlink_rename_data()
if [ ! -d $dir ]; then
echo 1
elif [ -f $dir/f1 ]; then
- echo 1
+ echo 2
elif [ -f $dir/f2 ]; then
- echo 1
+ echo 3
elif [ ! -f $dir/f3 ]; then
- echo 1
+ echo 4
elif test "Xtest_data" != "X$(cat $dir/f3)"; then
+ echo 5
+ else
+ echo 0
+ fi
+}
+
+function check_slave_read_only()
+{
+ volum=$1
+ gluster volume info $1 | grep 'features.read-only: on'
+ echo $?
+}
+
+function create_rename_with_existing_destination()
+{
+ dir=$1/rename_with_existing_destination
+ mkdir $dir
+ for i in {1..5}
+ do
+ echo "Data_set$i" > $dir/data_set$i
+ mv $dir/data_set$i $dir/data_set -f
+ done
+}
+
+function verify_rename_with_existing_destination()
+{
+ dir=$1/rename_with_existing_destination
+
+ if [ ! -d $dir ]; then
echo 1
+ elif [ ! -f $dir/data_set ]; then
+ echo 2
+ elif [ -f $dir/data_set1 ]; then
+ echo 3
+ elif [ -f $dir/data_set2 ]; then
+ echo 4
+ elif [ -f $dir/data_set3 ]; then
+ echo 5
+ elif [ -f $dir/data_set4 ]; then
+ echo 6
+ elif [ -f $dir/data_set5 ]; then
+ echo 7
+ elif test "XData_set5" != "X$(cat $dir/data_set)"; then
+ echo 8
else
echo 0
fi