summaryrefslogtreecommitdiffstats
path: root/tests/geo-rep.rc
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-05-28 19:26:00 +0530
committerVenky Shankar <vshankar@redhat.com>2015-08-11 23:38:06 -0700
commitdace4bbd0fdce567703a1a8d2d74a0a3f166f334 (patch)
tree73a44cc2987f0397f3ceb0c176cec5225ddc22e9 /tests/geo-rep.rc
parent64e6836ac8fb96f38a859eea0d8525cd9bd2693f (diff)
tests: New simple geo-rep regression test suite
This is a new simple regression test suite for geo-replication. This is written keeping in mind the run time for regression test. The existing regression test suite is rigorous one and could be run nightly. Hence the existing geo-rep tests are being removed as part of this. Also re-enable geo-rep regression with this patch. Thanks Aravinda for initial template and plan. Change-Id: If544ac295eaf67ac66e0b071903cc1096e71d437 BUG: 1227624 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/11058 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'tests/geo-rep.rc')
-rw-r--r--tests/geo-rep.rc183
1 files changed, 183 insertions, 0 deletions
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
new file mode 100644
index 00000000000..4ef0796184b
--- /dev/null
+++ b/tests/geo-rep.rc
@@ -0,0 +1,183 @@
+function check_status()
+{
+ local search_key=$1
+ $GEOREP_CLI $master $slave status detail | egrep -i "$search_key"
+}
+
+function check_status_num_rows()
+{
+ local search_key=$1
+ $GEOREP_CLI $master $slave status detail | egrep -i "$search_key" | wc -l
+}
+
+function create_data()
+{
+ prefix=$1
+
+ # GF_FOP_MKNOD
+ # GF_FOP_MKDIR
+ # GF_FOP_UNLINK
+ # GF_FOP_RMDIR
+ # GF_FOP_SYMLINK
+ # GF_FOP_RENAME
+ # GF_FOP_LINK
+ # GF_FOP_SETXATTR
+ # GF_FOP_REMOVEXATTR
+ # GF_FOP_CREATE
+ # GF_FOP_SETATTR
+
+ # Regular file
+ touch ${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
+ touch ${master_mnt}/${prefix}_d3
+
+ # Hardlink
+ ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1
+
+ # Symlink
+ ln -s ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_sl1
+
+ # data
+ echo "Hello World!" >> ${master_mnt}/${prefix}_f1
+
+ # UNLINK
+ rm ${master_mnt}/${prefix}_f2
+
+ # RMDIR
+ rmdir ${master_mnt}/${prefix}_d2
+
+ # Rename - File
+ mv ${master_mnt}/${prefix}_f3 ${master_mnt}/${prefix}_f4
+
+ # Rename - Dir
+ mv ${master_mnt}/${prefix}_d3 ${master_mnt}/${prefix}_d4
+}
+
+function regular_file_ok()
+{
+ local file_type=$(stat --format "%F" "$1")
+ if test "X$file_type" != "Xregular file"; then return 1; fi
+}
+
+function directory_ok()
+{
+ file_type=$(stat --format "%F" "$1")
+ if test "X$file_type" != "Xdirectory"; then return 1; fi
+}
+
+function unlink_ok()
+{
+ stat "$1" stat ./case > /dev/null 2>&1
+ rc=$?
+ if test $rc != 0; then return 0; fi
+ return 1;
+}
+
+function hardlink_file_ok()
+{
+ orig_file=$1
+ link_file=$2
+
+ orig_inode=$(stat --format "%i" "$orig_file")
+ rc=$?
+ if test $rc != 0; then return $rc; fi
+
+ link_inode=$(stat --format "%i" "$link_file")
+ rc=$?
+ if test $rc != 0; then return $rc; fi
+
+ if test $orig_inode != $link_inode
+ then
+ return 1
+ fi
+}
+
+function data_ok()
+{
+ path=$1
+ data1=$2
+ data2=$(cat $path)
+ if test "X$data1" != "X$data2"
+ then
+ return 1
+ fi
+}
+
+function symlink_ok()
+{
+ local orig_file_name=$(basename $1)
+ local symlink_file=$2
+
+ local file_type=$(stat --format "%F" "$symlink_file")
+ if test "X$file_type" != "Xsymbolic link"; then return 1; fi
+
+ local fname=$(stat $symlink_file --format "%N")
+ if test "X$fname" != "X$orig_file_name"; then return 1; fi
+}
+
+function rename_ok()
+{
+ old_name=$1
+ new_name=$2
+
+ if [ -f $old_name ]
+ then
+ return 1
+ fi
+
+ if [ ! -f $new_name ]
+ then
+ return 1
+ fi
+}
+
+function data_tests()
+{
+ local prefix=$1
+
+ sleep 10
+ #Regular file checking
+ regular_file_ok ${slave_mnt}/${prefix}_f1
+ if test $? != 0; then return $?; fi
+
+ #Directory checking
+ directory_ok ${slave_mnt}/${prefix}_d1
+ if test $? != 0; then return $?; fi
+
+ #Rename file/dir checking
+ rename_ok ${slave_mnt}/${prefix}_f3 ${slave_mnt}/${prefix}_f4
+ if test $? != 0; then return $?; fi
+ rename_ok ${slave_mnt}/${prefix}_d3 ${slave_mnt}/${prefix}_d4
+ if test $? != 0; then return $?; fi
+
+ #Symlink
+ symlink_ok ${slave_mnt}/${prefix}_f1 ${slave_mnt}/${prefix}_sl1
+ if test $? != 0; then return $?; fi
+
+ #Hardlink
+ hardlink_file_ok ${slave_mnt}/${prefix}_f1 ${slave_mnt}/${prefix}_hl1
+ if test $? != 0; then return $?; fi
+
+ #Unlink/rmdir checking
+ unlink_ok ${slave_mnt}/${prefix}_f2
+ if test $? != 0; then return $?; fi
+ unlink_ok ${slave_mnt}/${prefix}_d2
+ if test $? != 0; then return $?; fi
+
+ #Data
+ data_ok ${master_mnt}/${prefix}_f1 "Hello World!"
+ if test $? != 0; then return $?; fi
+}
+
+function create_georep_session()
+{
+ $CLI system:: execute gsec_create
+ if test $? != 0; then return $?; fi
+ $CLI volume geo-rep $master $slave create push-pem
+ if test $? != 0; then return $?; fi
+}