diff options
-rwxr-xr-x | run-tests.sh | 4 | ||||
-rw-r--r-- | tests/geo-rep.rc | 183 | ||||
-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-basic-dr-rsync.t | 89 | ||||
-rw-r--r-- | tests/geo-rep/georep-basic-dr-tarssh.t | 94 | ||||
-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 | ||||
-rw-r--r-- | tests/include.rc | 4 |
14 files changed, 371 insertions, 961 deletions
diff --git a/run-tests.sh b/run-tests.sh index 6763fa2f028..50fe080c2ac 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -164,8 +164,7 @@ function run_tests() return $match } RES=0 - for t in $(find ${regression_testsdir}/tests | grep -v geo-rep \ - | LC_COLLATE=C sort) ; do + for t in $(find ${regression_testsdir}/tests | LC_COLLATE=C sort) ; do if match $t "$@" ; then if [ -d $t ] ; then echo "Running tests in directory $t" @@ -208,7 +207,6 @@ function is_bad_test () function run_all () { find ${regression_testsdir}/tests -name '*.t' \ - | grep -v geo-rep \ | LC_COLLATE=C sort \ | while read t; do old_cores=$(ls /core.* 2> /dev/null | wc -l) 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 +} diff --git a/tests/geo-rep/compare-arequal.py b/tests/geo-rep/compare-arequal.py deleted file mode 100644 index 6d9850337b8..00000000000 --- a/tests/geo-rep/compare-arequal.py +++ /dev/null @@ -1,244 +0,0 @@ -#!/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 deleted file mode 100644 index 432c1d77f31..00000000000 --- a/tests/geo-rep/compare-gfid.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/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 deleted file mode 100644 index 53489082574..00000000000 --- a/tests/geo-rep/geo-rep-config.rc +++ /dev/null @@ -1,14 +0,0 @@ -#!/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 deleted file mode 100644 index 400f88c53a6..00000000000 --- a/tests/geo-rep/geo-rep-helper.rc +++ /dev/null @@ -1,296 +0,0 @@ -#!/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-basic-dr-rsync.t b/tests/geo-rep/georep-basic-dr-rsync.t new file mode 100644 index 00000000000..7562a206f2a --- /dev/null +++ b/tests/geo-rep/georep-basic-dr-rsync.t @@ -0,0 +1,89 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../geo-rep.rc + +### Basic Tests with Distribute Replicate volumes + +##Cleanup and start glusterd +cleanup; +TEST glusterd; +TEST pidof glusterd + + +##Variables +GEOREP_CLI="$CLI volume geo-replication" +master=$GMV0 +slave=${H0}::${GSV0} +num_active=2 +num_passive=2 +master_mnt=$M0 +slave_mnt=$M1 + +############################################################ +#SETUP VOLUMES AND GEO-REPLICATION +############################################################ + +##create_and_start_master_volume +TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4}; +TEST $CLI volume start $GMV0 + +##create_and_start_slave_volume +TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; #5 +TEST $CLI volume start $GSV0 + +##Create, start and mount meta_volume +TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3}; +TEST $CLI volume start $META_VOL +TEST mkdir -p $META_MNT +TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT #10 + +##Mount master +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +##Mount slave +TEST glusterfs -s $H0 --volfile-id $GSV0 $M1 + +############################################################ +#BASIC GEO-REPLICATION TESTS +############################################################ + +#Check Hybrid Crawl +TEST create_data "hybrid" +TEST create_georep_session $master $slave +EXPECT 4 check_status_num_rows "Created" #15 + +#Enable_metavolume +TEST $GEOREP_CLI $master $slave config use_meta_volume true + +#Start_georep +TEST $GEOREP_CLI $master $slave start + +sleep 10 +EXPECT 2 check_status_num_rows "Active" +EXPECT 2 check_status_num_rows "Passive" +TEST data_tests "hybrid" #20 + +#Check History Crawl. +TEST $GEOREP_CLI $master $slave stop +TEST create_data "history" +TEST $GEOREP_CLI $master $slave start +sleep 10 +EXPECT 2 check_status_num_rows "Active" +EXPECT 2 check_status_num_rows "Passive" #25 +TEST data_tests "history" + +#Check History Crawl. +TEST create_data "changelog" +sleep 15 +TEST check_status "Changelog Crawl" +TEST data_tests "changelog" + +#Stop Geo-rep +TEST $GEOREP_CLI $master $slave stop #30 + +#Delete Geo-rep +TEST $GEOREP_CLI $master $slave delete + +cleanup; diff --git a/tests/geo-rep/georep-basic-dr-tarssh.t b/tests/geo-rep/georep-basic-dr-tarssh.t new file mode 100644 index 00000000000..cb4b7c55532 --- /dev/null +++ b/tests/geo-rep/georep-basic-dr-tarssh.t @@ -0,0 +1,94 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../geo-rep.rc + +################################################# +# BASIC TESTS WITH DISTRIBUTE REPLICATE VOLUMES +################################################# + +##Cleanup and start glusterd +cleanup; +TEST glusterd; +TEST pidof glusterd + + +##Variables +GEOREP_CLI="$CLI volume geo-replication" +master=$GMV0 +slave=${H0}::${GSV0} +num_active=2 +num_passive=2 +master_mnt=$M0 +slave_mnt=$M1 + +############################################################ +#SETUP VOLUMES AND GEO-REPLICATION +############################################################ + +##create_and_start_master_volume +TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4}; +TEST $CLI volume start $GMV0 + +##create_and_start_slave_volume +TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4}; #5 +TEST $CLI volume start $GSV0 + +##Create, start and mount meta_volume +TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3}; +TEST $CLI volume start $META_VOL +TEST mkdir -p $META_MNT +TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT #10 + +##Mount master +TEST glusterfs -s $H0 --volfile-id $GMV0 $M0 + +##Mount slave +TEST glusterfs -s $H0 --volfile-id $GSV0 $M1 + +############################################################ +#BASIC GEO-REPLICATION TESTS +############################################################ + +#Check Hybrid Crawl +TEST create_data "hybrid" +TEST create_georep_session $master $slave +EXPECT 4 check_status_num_rows "Created" #15 + +#Enable_metavolume +TEST $GEOREP_CLI $master $slave config use_meta_volume true + +#Config tarssh as sync-engine +TEST $GEOREP_CLI $master $slave config use_tarssh true + +#Start_georep +TEST $GEOREP_CLI $master $slave start + +sleep 10 +EXPECT 2 check_status_num_rows "Active" +EXPECT 2 check_status_num_rows "Passive" #20 +TEST data_tests "hybrid" + +#Check History Crawl. +TEST $GEOREP_CLI $master $slave stop +TEST create_data "history" +TEST $GEOREP_CLI $master $slave start +sleep 10 +EXPECT 2 check_status_num_rows "Active" #25 +EXPECT 2 check_status_num_rows "Passive" +TEST data_tests "history" + +#Check History Crawl. +TEST create_data "changelog" +sleep 15 +TEST check_status "Changelog Crawl" +TEST data_tests "changelog" #30 + +#Stop Geo-rep +TEST $GEOREP_CLI $master $slave stop + +#Delete Geo-rep +TEST $GEOREP_CLI $master $slave delete + +cleanup; diff --git a/tests/geo-rep/georep-rsync-changelog.t b/tests/geo-rep/georep-rsync-changelog.t deleted file mode 100644 index eda06a36df6..00000000000 --- a/tests/geo-rep/georep-rsync-changelog.t +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 deleted file mode 100644 index af23a526ffb..00000000000 --- a/tests/geo-rep/georep-rsync-hybrid.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/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 deleted file mode 100644 index 75c379c8486..00000000000 --- a/tests/geo-rep/georep-setup.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 deleted file mode 100644 index 1f0e817f551..00000000000 --- a/tests/geo-rep/georep-tarssh-changelog.t +++ /dev/null @@ -1,73 +0,0 @@ -#!/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 deleted file mode 100644 index af23a526ffb..00000000000 --- a/tests/geo-rep/georep-tarssh-hybrid.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/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/include.rc b/tests/include.rc index 4a35a7d04cf..0901adeb72e 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -9,6 +9,10 @@ GMV0=${GMV0:=master}; # master volume name to use in geo-rep tests GSV0=${GSV0:=slave}; # slave volume name to use in geo-rep tests B0=${B0:=/d/backends}; # top level of brick directories WORKDIRS="$B0 $M0 $M1 $M2 $N0 $N1" + +META_VOL=${META_VOL:=gluster_shared_storage}; # shared gluster storage volume used by snapshot scheduler, nfs ganesha and geo-rep. +META_MNT=${META_MNT:=/var/run/gluster/shared_storage}; # Mount point of shared gluster volume. + CC=cc OSTYPE=$(uname -s) |