summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bug-1040423.t
blob: 6dae9eac6e9d7d8e8b0d3b7a7484cb9bba97b82b (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
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash

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

cleanup

function _init() {
# Start glusterd
TEST glusterd;
TEST pidof glusterd;
TEST $CLI volume info;

# Lets create volume
TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};

## Verify volume is created
EXPECT "$V0" volinfo_field $V0 'Volume Name';
EXPECT 'Created' volinfo_field $V0 'Status';

#Start volume and verify
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0

#Enable Quota
TEST $CLI volume quota $V0 enable

#As quotad consumes some time to connect to brick process we invoke sleep
sleep 10;

#set limit of 1GB of quota on root
TEST $CLI volume quota $V0 limit-usage / 1GB
}

function get_hardlimit()
{
        VOLUME=$1

        $CLI volume quota $VOLUME list | tail -1 | sed "s/ \{1,\}/ /g" |
                                                cut -d' ' -f 2
}

function check_fattrs {

touch $M0/file1;

#This confirms that pgfid is also filtered
TEST ! "getfattr -d -e hex -m . $M0/file1 | grep pgfid ";

#just check for quota xattr are visible or not
TEST ! "getfattr -d -e hex -m . $M0 | grep quota";

#setfattr should fail
TEST ! setfattr -n trusted.glusterfs.quota.limit-set -v 10 $M0;

#remove xattr should fail
TEST ! setfattr -x trusted.glusterfs.quota.limit-set $M0;

#check if list command still shows the correct value or not

EXPECT "1.0GB" get_hardlimit $V0

}

_init;
check_fattrs;
cleanup