diff options
Diffstat (limited to 'tests/geo-rep')
-rw-r--r-- | tests/geo-rep/compare-arequal.py | 244 | ||||
-rw-r--r-- | tests/geo-rep/compare-gfid.py | 95 | ||||
-rw-r--r-- | tests/geo-rep/geo-rep-config.rc | 14 | ||||
-rw-r--r-- | tests/geo-rep/geo-rep-helper.rc | 296 | ||||
-rw-r--r-- | tests/geo-rep/georep-rsync-changelog.t | 73 | ||||
-rw-r--r-- | tests/geo-rep/georep-rsync-hybrid.t | 65 | ||||
-rw-r--r-- | tests/geo-rep/georep-setup.t | 33 | ||||
-rw-r--r-- | tests/geo-rep/georep-tarssh-changelog.t | 73 | ||||
-rw-r--r-- | tests/geo-rep/georep-tarssh-hybrid.t | 65 |
9 files changed, 958 insertions, 0 deletions
diff --git a/tests/geo-rep/compare-arequal.py b/tests/geo-rep/compare-arequal.py new file mode 100644 index 00000000000..6d9850337b8 --- /dev/null +++ b/tests/geo-rep/compare-arequal.py @@ -0,0 +1,244 @@ +#!/usr/bin/python + +import sys +import os +import re +import tempfile +import subprocess +from multiprocessing import Pool +import time +from optparse import OptionParser + +slave_dict = {} +master_res = '' + + +def get_arequal_checksum(me, mnt): + global slave_dict + master_cmd = ['./tests/utils/arequal-checksum', '-p', mnt] + print "Calculating "+me+" checksum ..." + print "" + p = subprocess.Popen(master_cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + ret = p.wait() + stdout, stderr = p.communicate() + if ret: + print "Failed to get the checksum of " + me + " with following error" + print stderr + return 1 + else: + return stdout + + +def get_file_count(me, mnt): + global slave_dict + master_cmd = ['find ' + mnt + ' |wc -l'] + print "Calculating " + me + " files ..." + print "" + p = subprocess.Popen(master_cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, shell=True) + ret = p.wait() + stdout, stderr = p.communicate() + if ret: + print "Failed to get the count of files in " + me + + " with following error" + print stderr + return 1 + else: + return stdout.strip() + + +def compare_checksum(master_mnt, slave_dict): + proc = len(slave_dict)+1 + pool = Pool(processes=proc) + master_res = pool.apply_async(get_arequal_checksum, args=("master", + master_mnt)) + results = [(slave, pool.apply_async(get_arequal_checksum, + args=(slave_dict[slave]["vol"], + slave_dict[slave]["mnt"]))) + for slave in slave_dict] + + pool.close() + pool.join() + for slave, result in results: + slave_dict[slave]["res"] = result.get() + # exception: OSError + + master_res = master_res.get() + + print "arequal-checksum of master is : \n %s" % master_res + for slave in slave_dict: + print "arequal-checksum of geo_rep_slave %s: \n %s" % ( + slave_dict[slave]["vol"], slave_dict[slave]["res"]) + + master_files, master_total = re.findall('Total[\s]+:\s(\w+)', master_res) + master_reg_meta, master_reg = re.findall('Regular files[\s]+:\s(\w+)', + master_res)[1:] + master_dir_meta, master_dir = re.findall('Directories[\s]+:\s(\w+)', + master_res)[1:] + + ret = 0 + for slave in slave_dict: + slave_dict[slave]["files"], slave_dict[slave]["total"] = re.findall( + 'Total[\s]+:\s(\w+)', slave_dict[slave]["res"]) + slave_dict[slave]["reg_meta"], slave_dict[slave]["reg"] = re.findall( + 'Regular files[\s]+:\s(\w+)', slave_dict[slave]["res"])[1:] + slave_dict[slave]["dir_meta"], slave_dict[slave]["dir"] = re.findall( + 'Directories[\s]+:\s(\w+)', slave_dict[slave]["res"])[1:] + + if master_reg_meta != slave_dict[slave]["reg_meta"]: + print ("Meta data checksum for regular files doesn't match " + + "between master and "+slave_dict[slave]["vol"]) + ret = 67 + + if master_dir_meta != slave_dict[slave]["dir_meta"]: + print ("Meta data checksum for directories doesn't match " + + "between master and "+slave_dict[slave]["vol"]) + ret = 68 + + if master_files != slave_dict[slave]["files"]: + print ("Failed to sync all the files from master to " + + slave_dict[slave]["vol"]) + ret = 1 + + if master_total != slave_dict[slave]["total"]: + if master_reg != slave_dict[slave]["reg"]: + print ("Checksum for regular files doesn't match " + + "between master and "+slave_dict[slave]["vol"]) + ret = 1 + elif master_dir != slave_dict[slave]["dir"]: + print ("Checksum for directories doesn't match between " + + "master and "+slave_dict[slave]["vol"]) + ret = 1 + else: + print ("Checksum for symlinks or others doesn't match " + + "between master and "+slave_dict[slave]["vol"]) + ret = 1 + + if ret is 0: + print ("Successfully synced all the files from master " + + "to the "+slave_dict[slave]["vol"]) + + return ret + + +def compare_filecount(master_mnt, slave_dict): + proc = len(slave_dict)+1 + pool = Pool(processes=proc) + + master_res = pool.apply_async(get_file_count, args=("master", master_mnt)) + results = [(slave, pool.apply_async(get_file_count, + args=(slave_dict[slave]["vol"], + slave_dict[slave]["mnt"]))) + for slave in slave_dict] + + pool.close() + pool.join() + for slave, result in results: + slave_dict[slave]["res"] = result.get() + + master_res = master_res.get() + ret = 0 + for slave in slave_dict: + if not master_res == slave_dict[slave]["res"]: + print ("files count between master and " + + slave_dict[slave]["vol"]+" doesn't match yet") + ret = 1 + + return ret + + +def parse_url(url): + match = re.search(r'([\w - _ @ \.]+)::([\w - _ @ \.]+)', url) + if match: + node = match.group(1) + vol = match.group(2) + else: + print 'given url is not a valid.' + sys.exit(1) + return node, vol + + +def cleanup(master_mnt, slave_dict): + try: + os.system("umount %s" % (master_mnt)) + except: + print("Failed to unmount the master volume") + + for slave in slave_dict: + + try: + os.system("umount %s" % (slave_dict[slave]["mnt"])) + os.removedirs(slave_dict[slave]["mnt"]) + except: + print("Failed to unmount the "+slave+" volume") + + os.removedirs(master_mnt) + + +def main(): + + slaves = args[1:] + + masterurl = args[0] + master_node, mastervol = parse_url(masterurl) + master_mnt = tempfile.mkdtemp() + + i = 1 + for slave in slaves: + slave_dict["slave"+str(i)] = {} + slave_dict["slave"+str(i)]["node"], slave_dict[ + "slave"+str(i)]["vol"] = parse_url(slave) + slave_dict["slave"+str(i)]["mnt"] = tempfile.mkdtemp() + i += 1 + + try: + print ("mounting the master volume on "+master_mnt) + os.system("glusterfs -s %s --volfile-id %s %s" % (master_node, + mastervol, + master_mnt)) + time.sleep(3) + except: + print("Failed to mount the master volume") + + for slave in slave_dict: + print slave + print slave_dict[slave] + try: + print ("mounting the slave volume on "+slave_dict[slave]['mnt']) + os.system("glusterfs -s %s --volfile-id %s %s" % ( + slave_dict[slave]["node"], slave_dict[slave]["vol"], + slave_dict[slave]["mnt"])) + time.sleep(3) + except: + print("Failed to mount the "+slave+" volume") + + res = 0 + if option.check == "arequal": + res = compare_checksum(master_mnt, slave_dict) + elif option.check == "find": + res = compare_filecount(master_mnt, slave_dict) + else: + print "wrong options given" + + cleanup(master_mnt, slave_dict) + + sys.exit(res) + + +if __name__ == '__main__': + + usage = "usage: %prog [option] <master-host>::<master-vol> \ + <slave1-host>::<slave1-vol> . . ." + parser = OptionParser(usage=usage) + parser.add_option("-c", dest="check", action="store", type="string", + default="arequal", + help="size of the files to be used [default: %default]") + (option, args) = parser.parse_args() + if not args: + print "usage: <script> [option] <master-host>::<master-vol>\ + <slave1-host>::<slave1-vol> . . ." + print "" + sys.exit(1) + + main() diff --git a/tests/geo-rep/compare-gfid.py b/tests/geo-rep/compare-gfid.py new file mode 100644 index 00000000000..432c1d77f31 --- /dev/null +++ b/tests/geo-rep/compare-gfid.py @@ -0,0 +1,95 @@ +#!/usr/bin/python + +# Most of this script was written by M S Vishwanath Bhat (vbhat@redhat.com) + +import re +import os +import sys +import xattr +import tempfile + + +def parse_url(url): + match = re.search(r'([\w - _ @ \.]+)::([\w - _ @ \.]+)', url) + if match: + node = match.group(1) + vol = match.group(2) + else: + print 'given url is not a valid url.' + sys.exit(1) + return node, vol + + +def cleanup(master_mnt, slave_mnt): + try: + os.system("umount %s" % (master_mnt)) + except: + print("Failed to unmount the master volume") + try: + os.system("umount %s" % (slave_mnt)) + except: + print("Failed to unmount the slave volume") + + os.removedirs(master_mnt) + os.removedirs(slave_mnt) + + +def main(): + + masterurl = sys.argv[1] + slaveurl = sys.argv[2] + slave_node, slavevol = parse_url(slaveurl) + master_node, mastervol = parse_url(masterurl) + + master_mnt = tempfile.mkdtemp() + slave_mnt = tempfile.mkdtemp() + + try: + print "Mounting master volume on a temp mnt_pnt" + os.system("glusterfs -s %s --volfile-id %s %s" % (master_node, + mastervol, + master_mnt)) + except: + print("Failed to mount the master volume") + cleanup(master_mnt, slave_mnt) + sys.exit(1) + + try: + print "Mounting slave voluem on a temp mnt_pnt" + os.system("glusterfs -s %s --volfile-id %s %s" % (slave_node, slavevol, + slave_mnt)) + except: + print("Failed to mount the master volume") + cleanup(master_mnt, slave_mnt) + sys.exit(1) + + slave_file_list = [slave_mnt] + for top, dirs, files in os.walk(slave_mnt, topdown=False): + for subdir in dirs: + slave_file_list.append(os.path.join(top, subdir)) + for file in files: + slave_file_list.append(os.path.join(top, file)) + + # chdir and then get the gfid, so that you don't need to replace + gfid_attr = 'glusterfs.gfid' + ret = 0 + for sfile in slave_file_list: + mfile = sfile.replace(slave_mnt, master_mnt) + if xattr.getxattr(sfile, gfid_attr, True) != xattr.getxattr( + mfile, gfid_attr, True): + print ("gfid of file %s in slave is different from %s" + + " in master" % (sfile, mfile)) + ret = 1 + + cleanup(master_mnt, slave_mnt) + + sys.exit(ret) + + +if __name__ == '__main__': + if len(sys.argv[1:]) < 2: + print ("Please pass master volume name and slave url as arguments") + print ("USAGE : python <script> <master-host>::<master-vol> " + + "<slave-host>::<slave-vol>") + sys.exit(1) + main() diff --git a/tests/geo-rep/geo-rep-config.rc b/tests/geo-rep/geo-rep-config.rc new file mode 100644 index 00000000000..53489082574 --- /dev/null +++ b/tests/geo-rep/geo-rep-config.rc @@ -0,0 +1,14 @@ +#!/bin/bash + +#LOG_DIR="$DEFAULT_LOG_FILE_DIRECTORY/glusterfs/geo-rep-auto-logs" +LOG_DIR="/usr/local/var/log/geo-rep-auto-logs" +LOG_FILE="$LOG_DIR/geo-rep-auto.log.`date +%Y%m%d-%H%M%S`" +FILE_TYPE="text" # it can text, sparse or tar +nf="5" # number of files in each directory when DIR_STR is MULTI +ns="500" # number of files when DIR_STR is SINGLE +DIR_STR="MULTI" # It can be either SINGLE or MULTI + +# Not using this option for now, can be used in the future. +SYNC_MODE="rsync" # this option can take another option "tarssh" + +mkdir -p $LOG_DIR diff --git a/tests/geo-rep/geo-rep-helper.rc b/tests/geo-rep/geo-rep-helper.rc new file mode 100644 index 00000000000..de8a6817305 --- /dev/null +++ b/tests/geo-rep/geo-rep-helper.rc @@ -0,0 +1,296 @@ +#!/bin/bash + +function geo_rep_checkpoint_status() +{ + echo "Verifying the sync status using geo-rep checkpoint" >> $LOG_FILE + local timeout=300 + local temp_status="NOTOK" + echo "setting the checkpoint" >> $LOG_FILE + + $CLI volume geo-rep $GMV0 $H0::$GSV0 config checkpoint now >> $LOG_FILE 2>&1 + +# There is a bug, where in after checkpoint set, geo-rep status still +# shows the old data for the first execution of geo-rep status. Running +#geo-rep status to clear that. + $CLI volume geo-replication $GMV0 $H0::$GSV0 status >> $LOG_FILE 2>&1 + + while [ $timeout -gt 0 ] && [ $temp_status == "NOTOK" ]; + do + $CLI volume geo-replication $GMV0 $H0::$GSV0 status | \ + egrep -i "not reached yet" 2>&1 >/dev/null + test $? -ne 0 && temp_status="completed" + echo "Waiting for the files to sync ..." >> $LOG_FILE + sleep 20 + timeout=`expr $timeout - 20` + echo "temp_status is $temp_status" >> $LOG_FILE + echo "geo-rep status output:" >> $LOG_FILE + $CLI volume geo-replication $GMV0 $H0::$GSV0 status detail >> \ + $LOG_FILE 2>&1 + + done + + echo "resetting the geo-rep checkpoint" >> $LOG_FILE + $CLI volume geo-rep $GMV0 $H0::$GSV0 config \!checkpoint >> $LOG_FILE 2>&1 + + if test $temp_status = "completed" ; then + echo "geo-rep checkpoint has completed" >> $LOG_FILE + return 0 + elif test $temp_status = "NOTOK" ; then + echo "geo-rep checkpoint has failed to complete within 300 seconds" >> \ + $LOG_FILE + return 1 + fi +} + + + +function geo_rep_arequal_status() +{ + + echo "Verifying the sync status using arequal" >> $LOG_FILE + local timeout=300 + local temp_status="NOTOK" + local comp_arequal="$(dirname $0)/compare-arequal.py" + + while [ $timeout -gt 0 ] && [ $temp_status == "NOTOK" ]; + do + echo "Waiting for the files to sync ..." >> $LOG_FILE + sleep 20 + timeout=`expr $timeout - 20` + + echo "calculating and comparing arequal checksum between $GMV0 and \ +$GSV0 " >> $LOG_FILE + python $comp_arequal $H0::$GMV0 $H0::$GSV0 >> $LOG_FILE 2>&1 + + local ret=$? + # There is a bug, where sometimes metadata checksum of directories + # and regular files don't match. This is to avoid that for now. + if [[ $ret -eq 0 || $ret -eq 67 || $ret -eq 68 ]] ;then + temp_status="completed" + fi + + done + + if test $temp_status = "completed" ; then + echo "checksum between master and slave match " >> $LOG_FILE + return 0 + elif test $temp_status = "NOTOK" ; then + echo "checksum between master and slave doesn't match" >> $LOG_FILE + return 1 + fi +} + + +function geo_rep_filecount_status() +{ + + echo "Verifying the sync status through files count" >> $LOG_FILE + local timeout=300 + local temp_status="NOTOK" + local comp_arequal="$(dirname $0)/compare-arequal.py" + + while [ $timeout -gt 0 ] && [ $temp_status == "NOTOK" ]; + do + echo "Waiting for the files to sync ..." >> $LOG_FILE + sleep 20 + timeout=`expr $timeout - 20` + + echo "calculating and comparing files count between $GMV0 and \ +$GSV0 " >> $LOG_FILE + python $comp_arequal -c "find" $H0::$GMV0 $H0::$GSV0 >> $LOG_FILE 2>&1 + + if [ $? -eq 0 ];then + temp_status="completed" + fi + + done + + if test $temp_status = "completed" ; then + echo "files count between master and slave match " >> $LOG_FILE + return 0 + elif test $temp_status = "NOTOK" ; then + echo "files count between master and slave doesn't match" >> $LOG_FILE + return 1 + fi +} + + + +function check_status_arequal() +{ +# checkpoint is failing to reach even though all the files got synced in the latest build. +# Hence not using checkpoint to check for sync status. +# geo_rep_checkpoint_status + local comp_arequal="$(dirname $0)/compare-arequal.py" + local comp_gfid="$(dirname $0)/compare-gfid.py" + + geo_rep_filecount_status + + geo_rep_arequal_status + + echo "calculating and comparing gfids between $GMV0 and $GSV0 " \ + >> $LOG_FILE + python $comp_gfid $H0::$GMV0 $H0::$GSV0 >> $LOG_FILE 2>&1 + + if [ $? != 0 ]; then + return 1 + else + echo "gfids between master and slave match" >> $LOG_FILE + fi + + echo "calculating and comparing arequal checksum between $GMV0 and $GSV0 " \ + >> $LOG_FILE + python $comp_arequal $H0::$GMV0 $H0::$GSV0 >> $LOG_FILE 2>&1 + + local rett=$? + + if [[ $rett -eq 0 || $rett -eq 67 || $rett -eq 68 ]] ;then + reta=0 + else + reta=1 + fi + + return $reta + +} + + + + +function create_data() +{ + fop=$1 + MNT_PNT=$2 + create_data="$(dirname $0)/../utils/create-files.py" + + if [ $DIR_STR == "MULTI" ];then + + python $create_data -n $nf --multi -b 10 -d 10 --random --max=2K \ + --min=1K -t $FILE_TYPE --fop=$fop $MNT_PNT >> $LOG_FILE 2>&1 + + elif [ $DIR_STR == "SINGLE" ];then + + python $create_data -n $ns --random --max=2K --min=1K -t $FILE_TYPE \ + --fop=$fop $MNT_PNT >> $LOG_FILE 2>&1 + + else + + echo "Wrong option for the create-files" >> $LOG_FILE + + fi + +} + + +function result() +{ + +local ret=$1 +local test=$2 +if [ $ret -ne 0 ]; then + echo -e "\n[ FAIL ] : $test has failed" >> $LOG_FILE + exit 1 +else + echo -e "\n[ PASS ] : $test has passed" >> $LOG_FILE +fi + +} + + +## hybrid crawl test-cases + +function hybrid_mode_test() +{ + local FOP=$1 + local MNT_PNT=$2 + echo -e "\n:::::::::::::::::::::::" >> $LOG_FILE + echo "Start of hybrid-mode-$DIR_STR-$FILE_TYPE-$FOP-test with \ +$MNT_PNT client" >> $LOG_FILE + echo -e ":::::::::::::::::::::::\n" >> $LOG_FILE + + local ret=0 + echo "stopping geo-rep session before creating data" >> $LOG_FILE + + $CLI volume geo-rep $GMV0 $H0::$GSV0 stop force >> $LOG_FILE 2>&1 + + if [ $? -ne 0 ]; then + echo "stopping geo-rep session has failed" >> $LOG_FILE + return 1 + fi + + create_data $FOP $MNT_PNT + + $CLI volume geo-rep $GMV0 $H0::$GSV0 start >> $LOG_FILE 2>&1 + + if [ $? -ne 0 ]; then + echo "starting geo-rep session has failed" >> $LOG_FILE + return 1 + fi + + check_status_arequal + + if [ $? -ne 0 ]; then + ret=1 + fi + + result $ret "hybrid-mode-$DIR_STR-$FILE_TYPE-$FOP-test with $CLIENT client" + + return $ret + +} + +#### Changelog based test-cases + +function changelog_mode_test() +{ + local FOP=$1 + local MNT_PNT=$2 + echo -e "\n:::::::::::::::::::::::" >> $LOG_FILE + echo "Start of changelog-mode-$DIR_STR-$FILE_TYPE-$FOP-test with \ +$MNT_PNT client" >> $LOG_FILE + echo -e ":::::::::::::::::::::::\n" >> $LOG_FILE + + local ret=0 + + create_data $FOP $MNT_PNT + + check_status_arequal + + if [ $? -ne 0 ]; then + ret=1 + fi + + result $ret "basic-changelog-$DIR_STR-$FILE_TYPE-$FOP-test with $CLIENT \ +client" + + return $ret +} + + +function changelog_mode_remove_test() +{ + MNT_PNT=$1 + + echo -e "\n:::::::::::::::::::::::" >> $LOG_FILE + echo "Start of changelog-mode-$DIR_STR-$FILE_TYPE-remove-test with \ +$MNT_PNT client" >> $LOG_FILE + echo -e ":::::::::::::::::::::::\n" >> $LOG_FILE + + local ret=0 + + if [ ! -z $MNT_PNT ]; then + rm -rvf $MNT_PNT >> $LOG_FILE + else + echo "Value of MNT_PNT is NULL" >> $LOG_FILE + fi + + check_status_arequal + if [ $? -ne 0 ]; then + ret=1 + fi + + result $ret "chnagelog-mode-$DIR_STR-$FILE_TYPE-remove-test with \ +$MNT_PNT client" + + return $ret +} diff --git a/tests/geo-rep/georep-rsync-changelog.t b/tests/geo-rep/georep-rsync-changelog.t new file mode 100644 index 00000000000..eda06a36df6 --- /dev/null +++ b/tests/geo-rep/georep-rsync-changelog.t @@ -0,0 +1,73 @@ +#!/bin/bash + +# Following tests involves geo-rep regresseion tests with changelog +# as change detector, and rsync as sync mode on both fuse and nfs mount + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/geo-rep-helper.rc +. $(dirname $0)/geo-rep-config.rc + +cleanup; +AREQUAL_PATH=$(dirname $0)/../utils +CFLAGS="" +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS + +TEST glusterd +TEST pidof glusterd + +setup_georep ; + +# start of tests on fuse mount + +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +TEST changelog_mode_test "create" $M0 + +TEST changelog_mode_test "chmod" $M0 + +TEST changelog_mode_test "chown" $M0 + +TEST changelog_mode_test "chgrp" $M0 + +# Bug 1083963 +#TEST changelog_mode_test "rename" $M0 + +TEST changelog_mode_test "truncate" $M0 + +TEST changelog_mode_test "symlink" $M0 + +# Bug 1003020 +#TEST changelog_mode_test "hardlink" $M0 + +#TEST changelog_mode_remove_test $M0 + +# start of tests on nfs mount + +TEST mount -t nfs -o vers=3,nolock $H0:$GMV0 $N0 + +TEST changelog_mode_test "create" $N0 + +TEST changelog_mode_test "chmod" $N0 + +TEST changelog_mode_test "chown" $N0 + +TEST changelog_mode_test "chgrp" $N0 + +#TEST changelog_mode_test "rename" $N0 + +TEST changelog_mode_test "truncate" $N0 + +TEST changelog_mode_test "symlink" $N0 + +#TEST changelog_mode_test "hardlink" $N0 + +#TEST changelog_mode_remove_test $N0 + +TEST rm -rf $AREQUAL_PATH/arequal-checksum +cleanup_georep; diff --git a/tests/geo-rep/georep-rsync-hybrid.t b/tests/geo-rep/georep-rsync-hybrid.t new file mode 100644 index 00000000000..af23a526ffb --- /dev/null +++ b/tests/geo-rep/georep-rsync-hybrid.t @@ -0,0 +1,65 @@ +#!/bin/bash + +# Following tests involves geo-rep tests with hybrid crawl +# as change detector, and rsync as sync mode on both fuse and nfs mount + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/geo-rep-helper.rc +. $(dirname $0)/geo-rep-config.rc + +cleanup; + +AREQUAL_PATH=$(dirname $0)/../utils +CFLAGS="" +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS + +TEST glusterd +TEST pidof glusterd + +setup_georep ; + +# start of tests on fuse mount + +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +TEST hybrid_mode_test "create" $M0 + +TEST hybrid_mode_test "chmod" $M0 + +TEST hybrid_mode_test "chown" $M0 + +TEST hybrid_mode_test "chgrp" $M0 + +TEST hybrid_mode_test "truncate" $M0 + +TEST hybrid_mode_test "symlink" $M0 + +#TEST hybrid_mode_test "hardlink" $M0 + +# start of tests on nfs mount + +TEST mount -t nfs -o vers=3,nolock $H0:$GMV0 $N0 + +TEST hybrid_mode_test "create" $N0 + +TEST hybrid_mode_test "chmod" $N0 + +TEST hybrid_mode_test "chown" $N0 + +TEST hybrid_mode_test "chgrp" $N0 + +TEST hybrid_mode_test "truncate" $N0 + +TEST hybrid_mode_test "symlink" $N0 + +#TEST hybrid_mode_test "hardlink" $N0 + +TEST rm -rf $AREQUAL_PATH/arequal-checksum + +cleanup_georep; diff --git a/tests/geo-rep/georep-setup.t b/tests/geo-rep/georep-setup.t new file mode 100644 index 00000000000..75c379c8486 --- /dev/null +++ b/tests/geo-rep/georep-setup.t @@ -0,0 +1,33 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4}; + +TEST $CLI volume start $GMV0 + +TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; + +TEST $CLI volume start $GSV0 + +TEST $CLI system:: execute gsec_create + +TEST $CLI volume geo-rep $GMV0 $H0::$GSV0 create push-pem + +TEST $CLI volume geo-rep $GMV0 $H0::$GSV0 start + +sleep 80 # after start geo-rep takes a minute to get stable + +TEST ! "$CLI volume geo-rep $GMV0 $H0::$GSV0 status | egrep -i 'faulty'" + +TEST "$CLI volume geo-rep $GMV0 $H0::$GSV0 status | egrep -i 'Changelog crawl'" + +TEST $CLI volume geo-rep $GMV0 $H0::$GSV0 stop + +TEST $CLI volume geo-rep $GMV0 $H0::$GSV0 delete diff --git a/tests/geo-rep/georep-tarssh-changelog.t b/tests/geo-rep/georep-tarssh-changelog.t new file mode 100644 index 00000000000..1f0e817f551 --- /dev/null +++ b/tests/geo-rep/georep-tarssh-changelog.t @@ -0,0 +1,73 @@ +#!/bin/bash + +# Following tests involves geo-rep regresseion tests with changelog +# as change detector, and rsync as sync mode on both fuse and nfs mount + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/geo-rep-helper.rc +. $(dirname $0)/geo-rep-config.rc + +cleanup; + +AREQUAL_PATH=$(dirname $0)/../utils +CFLAGS="" +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS + +TEST glusterd +TEST pidof glusterd + +setup_georep ; + +# start of tests on fuse mount + +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +TEST changelog_mode_test "create" $M0 + +TEST changelog_mode_test "chmod" $M0 + +TEST changelog_mode_test "chown" $M0 + +TEST changelog_mode_test "chgrp" $M0 + +#TEST changelog_mode_test "rename" $M0 + +TEST changelog_mode_test "truncate" $M0 + +TEST changelog_mode_test "symlink" $M0 + +#TEST changelog_mode_test "hardlink" $M0 + +#TEST changelog_mode_remove_test $M0 + +# start of tests on nfs mount + +TEST mount -t nfs -o vers=3,nolock $H0:$GMV0 $N0 + +TEST changelog_mode_test "create" $N0 + +TEST changelog_mode_test "chmod" $N0 + +TEST changelog_mode_test "chown" $N0 + +TEST changelog_mode_test "chgrp" $N0 + +#TEST changelog_mode_test "rename" $N0 + +TEST changelog_mode_test "truncate" $N0 + +TEST changelog_mode_test "symlink" $N0 + +#TEST changelog_mode_test "hardlink" $N0 + +#TEST changelog_mode_remove_test $N0 + +TEST rm -rf $AREQUAL_PATH/arequal-checksum + +cleanup_georep; diff --git a/tests/geo-rep/georep-tarssh-hybrid.t b/tests/geo-rep/georep-tarssh-hybrid.t new file mode 100644 index 00000000000..af23a526ffb --- /dev/null +++ b/tests/geo-rep/georep-tarssh-hybrid.t @@ -0,0 +1,65 @@ +#!/bin/bash + +# Following tests involves geo-rep tests with hybrid crawl +# as change detector, and rsync as sync mode on both fuse and nfs mount + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/geo-rep-helper.rc +. $(dirname $0)/geo-rep-config.rc + +cleanup; + +AREQUAL_PATH=$(dirname $0)/../utils +CFLAGS="" +test "`uname -s`" != "Linux" && { + CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; + CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; + CFLAGS="$CFLAGS -lintl"; +} +build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS + +TEST glusterd +TEST pidof glusterd + +setup_georep ; + +# start of tests on fuse mount + +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +TEST hybrid_mode_test "create" $M0 + +TEST hybrid_mode_test "chmod" $M0 + +TEST hybrid_mode_test "chown" $M0 + +TEST hybrid_mode_test "chgrp" $M0 + +TEST hybrid_mode_test "truncate" $M0 + +TEST hybrid_mode_test "symlink" $M0 + +#TEST hybrid_mode_test "hardlink" $M0 + +# start of tests on nfs mount + +TEST mount -t nfs -o vers=3,nolock $H0:$GMV0 $N0 + +TEST hybrid_mode_test "create" $N0 + +TEST hybrid_mode_test "chmod" $N0 + +TEST hybrid_mode_test "chown" $N0 + +TEST hybrid_mode_test "chgrp" $N0 + +TEST hybrid_mode_test "truncate" $N0 + +TEST hybrid_mode_test "symlink" $N0 + +#TEST hybrid_mode_test "hardlink" $N0 + +TEST rm -rf $AREQUAL_PATH/arequal-checksum + +cleanup_georep; |