summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bug-1034716.t
blob: e6260fca8cb6ddcad2513a8abf1f63cd78e66dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash

. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc

cleanup;

#Basic checks
TEST glusterd
TEST pidof glusterd
TEST $CLI volume info

#Create a distributed volume
TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2};
TEST $CLI volume start $V0

# Mount FUSE
TEST glusterfs -s $H0 --volfile-id $V0 $M0

#Create a file and perform fop on a DIR
TEST touch $M0/foo

function xattr_query_check() {
    local path=$1

    local ret=`getfattr -m . -d $path 2>&1 | grep -c 'trusted.glusterfs'`
    echo $ret
}

function set_xattr() {
    local path=$1
    local xa_name=$2
    local xa_val=$3

    setfattr -n $xa_name -v $xa_val $path
    echo $?
}

function remove_xattr() {
    local path=$1
    local xa_name=$2

    setfattr -x $xa_name $path
    echo $?
}

EXPECT 0 xattr_query_check $M0/
EXPECT 0 xattr_query_check $M0/foo

EXPECT 1 set_xattr $M0/ 'trusted.glusterfs.volume-id' 'foo'
EXPECT 1 remove_xattr $M0/ 'trusted.glusterfs.volume-id'


## Finish up
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
TEST $CLI volume stop $V0
TEST $CLI volume delete $V0;
TEST ! $CLI volume info $V0;

cleanup;