summaryrefslogtreecommitdiffstats
path: root/tests/bugs/distribute
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/distribute')
-rwxr-xr-xtests/bugs/distribute/bug-1117851.t101
-rw-r--r--tests/bugs/distribute/bug-1122443.t60
-rw-r--r--tests/bugs/distribute/bug-1600379.t54
-rwxr-xr-xtests/bugs/distribute/bug-1786679.t69
-rwxr-xr-xtests/bugs/distribute/issue-1327.t33
5 files changed, 156 insertions, 161 deletions
diff --git a/tests/bugs/distribute/bug-1117851.t b/tests/bugs/distribute/bug-1117851.t
deleted file mode 100755
index 62cb6b6..0000000
--- a/tests/bugs/distribute/bug-1117851.t
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/bash
-
-SCRIPT_TIMEOUT=250
-
-. $(dirname $0)/../../include.rc
-. $(dirname $0)/../../volume.rc
-
-create_files () {
- for i in {1..1000}; do
- orig=$(printf %s/abc%04d $1 $i)
- real=$(printf %s/src%04d $1 $i)
- # Make sure lots of these have linkfiles.
- echo "This is file $i" > $orig
- mv $orig $real
- done
- sync
-}
-
-move_files_inner () {
- sfile=$M0/status_$(basename $1)
- for i in {1..1000}; do
- src=$(printf %s/src%04d $1 $i)
- dst=$(printf %s/dst%04d $1 $i)
- mv $src $dst 2> /dev/null
- done
- echo "done" > $sfile
-}
-
-move_files () {
- #Create the status file here to prevent spurious failures
- #caused by the file not being created in time by the
- #background process
- sfile=$M0/status_$(basename $1)
- echo "running" > $sfile
- move_files_inner $* &
-}
-
-check_files () {
- errors=0
- for i in {1..1000}; do
- if [ ! -f $(printf %s/dst%04d $1 $i) ]; then
- if [ -f $(printf %s/src%04d $1 $i) ]; then
- echo "file $i didnt get moved" > /dev/stderr
- else
- echo "file $i is MISSING" > /dev/stderr
- errors=$((errors+1))
- fi
- fi
- done
- if [ $((errors)) != 0 ]; then
- : ls -l $1 > /dev/stderr
- fi
- return $errors
-}
-
-cleanup;
-
-TEST glusterd
-TEST pidof glusterd
-TEST $CLI volume info;
-
-TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4,5,6};
-
-EXPECT "$V0" volinfo_field $V0 'Volume Name';
-EXPECT 'Created' volinfo_field $V0 'Status';
-EXPECT '6' brick_count $V0
-
-TEST $CLI volume start $V0;
-EXPECT 'Started' volinfo_field $V0 'Status';
-
-## Mount FUSE with caching disabled (read-write)
-TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
-
-TEST create_files $M0
-
-## Mount FUSE with caching disabled (read-write) again
-TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M1;
-
-TEST move_files $M0
-TEST move_files $M1
-
-# It's regrettable that renaming 1000 files might take more than 30 seconds,
-# but on our test systems sometimes it does, so double the time from what we'd
-# use otherwise. There still seem to be some spurious failures, 1 in 20 when
-# this does not complete, added an additional 60 seconds to take false reports
-# out of the system, during test runs, especially on slower test systems.
-EXPECT_WITHIN 120 "done" cat $M0/status_0
-EXPECT_WITHIN 120 "done" cat $M1/status_1
-
-EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
-EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1
-TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
-TEST check_files $M0
-
-TEST $CLI volume stop $V0;
-EXPECT 'Stopped' volinfo_field $V0 'Status';
-
-TEST $CLI volume delete $V0;
-TEST ! $CLI volume info $V0;
-
-cleanup;
diff --git a/tests/bugs/distribute/bug-1122443.t b/tests/bugs/distribute/bug-1122443.t
deleted file mode 100644
index 906be70..0000000
--- a/tests/bugs/distribute/bug-1122443.t
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-
-. $(dirname $0)/../../include.rc
-. $(dirname $0)/../../volume.rc
-. $(dirname $0)/../../dht.rc
-
-make_files() {
- mkdir $1 && \
- ln -s ../ $1/symlink && \
- mknod $1/special_b b 1 2 && \
- mknod $1/special_c c 3 4 && \
- mknod $1/special_u u 5 6 && \
- mknod $1/special_p p && \
- touch -h --date=@1 $1/symlink && \
- touch -h --date=@2 $1/special_b &&
- touch -h --date=@3 $1/special_c &&
- touch -h --date=@4 $1/special_u &&
- touch -h --date=@5 $1/special_p
-}
-
-bug_1113050_workaround() {
- # Test if graph change has settled (bug-1113050?)
- test=$(stat -c "%n:%Y" $1 2>&1 | tr '\n' ',')
- if [ $? -eq 0 ] ; then
- echo RECONNECTED
- else
- echo WAITING
- fi
- return 0
-}
-
-cleanup
-
-TEST glusterd
-TEST pidof glusterd
-
-TEST $CLI volume create $V0 $H0:$B0/${V0}0
-TEST $CLI volume start $V0
-
-# Mount FUSE and create symlink
-TEST glusterfs -s $H0 --volfile-id $V0 $M0
-TEST make_files $M0/subdir
-
-# Get mtime before migration
-BEFORE="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')"
-
-# Migrate brick
-TEST $CLI volume add-brick $V0 $H0:$B0/${V0}1
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}0 start
-EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0 $H0:$B0/${V0}0"
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}0 commit
-
-# Get mtime after migration
-EXPECT_WITHIN 5 RECONNECTED bug_1113050_workaround $M0/subdir/*
-AFTER="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')"
-
-# Check if mtime is unchanged
-TEST [ "$AFTER" == "$BEFORE" ]
-
-cleanup
diff --git a/tests/bugs/distribute/bug-1600379.t b/tests/bugs/distribute/bug-1600379.t
new file mode 100644
index 0000000..8d2f615
--- /dev/null
+++ b/tests/bugs/distribute/bug-1600379.t
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+# Initialize
+#------------------------------------------------------------
+cleanup;
+
+# Start glusterd
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume info;
+
+# Create a volume
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}
+
+# Verify volume creation
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+# Start volume and verify successful start
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
+#------------------------------------------------------------
+
+# Test case - Remove xattr from killed brick on lookup
+#------------------------------------------------------------
+# Create a dir and set custom xattr
+TEST mkdir $M0/testdir
+TEST setfattr -n user.attr -v val $M0/testdir
+xattr_val=`getfattr -d $B0/${V0}2/testdir | awk '{print $1}'`;
+TEST ${xattr_val}='user.attr="val"';
+
+# Kill 2nd brick process
+TEST kill_brick $V0 $H0 $B0/${V0}2
+EXPECT_WITHIN ${PROCESS_UP_TIMEOUT} "1" online_brick_count
+
+# Remove custom xattr
+TEST setfattr -x user.attr $M0/testdir
+
+# Bring up the killed brick process
+TEST $CLI volume start $V0 force
+
+# Perform lookup
+sleep 5
+TEST ls $M0/testdir
+
+# Check brick xattrs
+xattr_val_2=`getfattr -d $B0/${V0}2/testdir`;
+TEST [ ${xattr_val_2} = ''] ;
+
+cleanup;
diff --git a/tests/bugs/distribute/bug-1786679.t b/tests/bugs/distribute/bug-1786679.t
new file mode 100755
index 0000000..219ce51
--- /dev/null
+++ b/tests/bugs/distribute/bug-1786679.t
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+SCRIPT_TIMEOUT=250
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../dht.rc
+
+
+# create 2 subvols
+# create a dir
+# create a file
+# change layout
+# remove the file
+# execute create from a different mount
+# Without the patch, the file will be present on both of the bricks
+
+cleanup
+
+function get_layout () {
+
+layout=`getfattr -n trusted.glusterfs.dht -e hex $1 2>&1 | grep dht | gawk -F"=" '{print $2}'`
+
+echo $layout
+
+}
+
+function set_layout()
+{
+ setfattr -n "trusted.glusterfs.dht" -v $1 $2
+}
+
+TEST glusterd
+TEST pidof glusterd
+
+BRICK1=$B0/${V0}-0
+BRICK2=$B0/${V0}-1
+
+TEST $CLI volume create $V0 $H0:$BRICK1 $H0:$BRICK2
+TEST $CLI volume start $V0
+
+# Mount FUSE and create symlink
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
+TEST mkdir $M0/dir
+TEST touch $M0/dir/file
+TEST ! stat "$BRICK1/dir/file"
+TEST stat "$BRICK2/dir/file"
+
+layout1="$(get_layout "$BRICK1/dir")"
+layout2="$(get_layout "$BRICK2/dir")"
+
+TEST set_layout $layout1 "$BRICK2/dir"
+TEST set_layout $layout2 "$BRICK1/dir"
+
+TEST rm $M0/dir/file -f
+TEST gluster v set $V0 client-log-level DEBUG
+
+#Without the patch in place, this client will create the file in $BRICK2
+#which will lead to two files being on both the bricks when a new client
+#create the file with the same name
+TEST touch $M0/dir/file
+
+TEST glusterfs -s $H0 --volfile-id $V0 $M1
+TEST touch $M1/dir/file
+
+TEST stat "$BRICK1/dir/file"
+TEST ! stat "$BRICK2/dir/file"
+
+cleanup
diff --git a/tests/bugs/distribute/issue-1327.t b/tests/bugs/distribute/issue-1327.t
new file mode 100755
index 0000000..acd8c8c
--- /dev/null
+++ b/tests/bugs/distribute/issue-1327.t
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+SCRIPT_TIMEOUT=250
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../dht.rc
+
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+
+BRICK1=$B0/${V0}-0
+BRICK2=$B0/${V0}-1
+
+TEST $CLI volume create $V0 $H0:$BRICK1 $H0:$BRICK2
+TEST $CLI volume start $V0
+
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
+TEST mkdir $M0/dir
+
+#remove dir from one of the brick
+TEST rmdir $BRICK2/dir
+
+#safe cache timeout for lookup to be triggered
+sleep 2
+
+TEST ls $M0/dir
+
+TEST stat $BRICK2/dir
+
+cleanup