summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-08-13 13:11:32 +0530
committerVenky Shankar <vshankar@redhat.com>2015-08-31 10:15:34 -0700
commite012bdc721945fb6d996e3f67881a705ef966026 (patch)
tree513c165d6fafc38a4c6ed71ef66c08d93e8fb580
parent7566c94633b602156755297493fad1d24d1ba52f (diff)
tests: Fix return value in geo-rep tests
Remove the function 'data_tests' and TEST each fop in testcase itself to determine the exact test that fails. Change-Id: Iffc3e2ac3b0fc0c7c64259fcdff8f27b146dcb9b BUG: 1227624 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/11907 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--tests/geo-rep.rc59
-rw-r--r--tests/geo-rep/georep-basic-dr-rsync.t50
-rw-r--r--tests/geo-rep/georep-basic-dr-tarssh.t45
3 files changed, 95 insertions, 59 deletions
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
index 4ef0796184b..208069c6918 100644
--- a/tests/geo-rep.rc
+++ b/tests/geo-rep.rc
@@ -40,10 +40,12 @@ function create_data()
ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1
# Symlink
- ln -s ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_sl1
+ cd ${master_mnt}
+ ln -s ${prefix}_f1 ${prefix}_sl1
+ cd -
# data
- echo "Hello World!" >> ${master_mnt}/${prefix}_f1
+ echo "HelloWorld!" >> ${master_mnt}/${prefix}_f1
# UNLINK
rm ${master_mnt}/${prefix}_f2
@@ -100,8 +102,10 @@ function hardlink_file_ok()
function data_ok()
{
path=$1
- data1=$2
+ data1="$2"
data2=$(cat $path)
+ echo "data1:$data1"
+ echo "data2:$data2"
if test "X$data1" != "X$data2"
then
return 1
@@ -110,13 +114,14 @@ function data_ok()
function symlink_ok()
{
- local orig_file_name=$(basename $1)
+ local orig_file_name=$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")
+ local fname=$(readlink $symlink_file)
if test "X$fname" != "X$orig_file_name"; then return 1; fi
}
@@ -136,48 +141,12 @@ function rename_ok()
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
+ rc=$?
+ if test $rc != 0; then return $rc; fi
$CLI volume geo-rep $master $slave create push-pem
- if test $? != 0; then return $?; fi
+ rc=$?
+ if test $rc != 0; then return $rc; fi
}
diff --git a/tests/geo-rep/georep-basic-dr-rsync.t b/tests/geo-rep/georep-basic-dr-rsync.t
index 7562a206f2a..4c1885b78b2 100644
--- a/tests/geo-rep/georep-basic-dr-rsync.t
+++ b/tests/geo-rep/georep-basic-dr-rsync.t
@@ -63,27 +63,63 @@ 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
+
+#DATA_TESTS HYBRID
+sleep 10
+TEST regular_file_ok ${slave_mnt}/hybrid_f1 #20
+TEST directory_ok ${slave_mnt}/$hybrid_d1
+TEST rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4
+TEST rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4
+TEST symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1
+TEST hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1 #25
+TEST unlink_ok ${slave_mnt}/hybrid_f2
+TEST unlink_ok ${slave_mnt}/hybrid_d2
+TEST data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!"
+
#Check History Crawl.
TEST $GEOREP_CLI $master $slave stop
-TEST create_data "history"
+TEST create_data "history" #30
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"
+EXPECT 2 check_status_num_rows "Passive"
+
+
+
+#data_tests "history"
+sleep 10
+TEST regular_file_ok ${slave_mnt}/history_f1
+TEST directory_ok ${slave_mnt}/history_d1 #35
+TEST rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4
+TEST rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4
+TEST symlink_ok history_f1 ${slave_mnt}/history_sl1
+TEST hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1
+TEST unlink_ok ${slave_mnt}/history_f2 #40
+TEST unlink_ok ${slave_mnt}/history_d2
+TEST data_ok ${slave_mnt}/history_f1 "HelloWorld!"
#Check History Crawl.
TEST create_data "changelog"
sleep 15
TEST check_status "Changelog Crawl"
-TEST data_tests "changelog"
+
+#data_tests "changelog"
+sleep 10
+TEST regular_file_ok ${slave_mnt}/changelog_f1 #45
+TEST directory_ok ${slave_mnt}/changelog_d1
+TEST rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4
+TEST rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4
+TEST symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1
+TEST hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 #50
+TEST unlink_ok ${slave_mnt}/changelog_f2
+TEST unlink_ok ${slave_mnt}/changelog_d2
+TEST data_ok ${slave_mnt}/changelog_f1 "HelloWorld!"
#Stop Geo-rep
-TEST $GEOREP_CLI $master $slave stop #30
+TEST $GEOREP_CLI $master $slave stop
#Delete Geo-rep
-TEST $GEOREP_CLI $master $slave delete
+TEST $GEOREP_CLI $master $slave delete #55
cleanup;
diff --git a/tests/geo-rep/georep-basic-dr-tarssh.t b/tests/geo-rep/georep-basic-dr-tarssh.t
index cb4b7c55532..ccf688c2701 100644
--- a/tests/geo-rep/georep-basic-dr-tarssh.t
+++ b/tests/geo-rep/georep-basic-dr-tarssh.t
@@ -68,25 +68,56 @@ 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"
+
+#DATA_TESTS HYBRID
+sleep 10
+TEST regular_file_ok ${slave_mnt}/hybrid_f1
+TEST directory_ok ${slave_mnt}/$hybrid_d1
+TEST rename_ok ${slave_mnt}/hybrid_f3 ${slave_mnt}/hybrid_f4
+TEST rename_ok ${slave_mnt}/hybrid_d3 ${slave_mnt}/hybrid_d4
+TEST symlink_ok hybrid_f1 ${slave_mnt}/hybrid_sl1 #25
+TEST hardlink_file_ok ${slave_mnt}/hybrid_f1 ${slave_mnt}/hybrid_hl1
+TEST unlink_ok ${slave_mnt}/hybrid_f2
+TEST unlink_ok ${slave_mnt}/hybrid_d2
+TEST data_ok ${slave_mnt}/hybrid_f1 "HelloWorld!"
#Check History Crawl.
-TEST $GEOREP_CLI $master $slave stop
+TEST $GEOREP_CLI $master $slave stop #30
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 "Active"
EXPECT 2 check_status_num_rows "Passive"
-TEST data_tests "history"
+#data_tests "history"
+sleep 10
+TEST regular_file_ok ${slave_mnt}/history_f1 #35
+TEST directory_ok ${slave_mnt}/history_d1
+TEST rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4
+TEST rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4
+TEST symlink_ok history_f1 ${slave_mnt}/history_sl1
+TEST hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 #40
+TEST unlink_ok ${slave_mnt}/history_f2
+TEST unlink_ok ${slave_mnt}/history_d2
+TEST data_ok ${slave_mnt}/history_f1 "HelloWorld!"
#Check History Crawl.
TEST create_data "changelog"
sleep 15
-TEST check_status "Changelog Crawl"
-TEST data_tests "changelog" #30
+TEST check_status "Changelog Crawl" #45
+#data_tests "changelog"
+sleep 10
+TEST regular_file_ok ${slave_mnt}/changelog_f1
+TEST directory_ok ${slave_mnt}/changelog_d1
+TEST rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4
+TEST rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4
+TEST symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 #50
+TEST hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1
+TEST unlink_ok ${slave_mnt}/changelog_f2
+TEST unlink_ok ${slave_mnt}/changelog_d2
+TEST data_ok ${slave_mnt}/changelog_f1 "HelloWorld!"
#Stop Geo-rep
-TEST $GEOREP_CLI $master $slave stop
+TEST $GEOREP_CLI $master $slave stop #55
#Delete Geo-rep
TEST $GEOREP_CLI $master $slave delete