summaryrefslogtreecommitdiffstats
path: root/tests/features/subdir-mount.t
blob: ab7ef35815b215eb305e4ab767129d9f9c427dbe (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash

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

cleanup;

## Start and create a volume
TEST glusterd
TEST pidof glusterd
TEST $CLI volume info;

TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4};

## Start volume and verify
TEST $CLI volume start $V0;

## Mount FUSE with caching disabled (read-write)
TEST $GFS -s $H0 --volfile-id $V0 --volume-name ${V0}-dht $M0;

TEST ! stat $M0/subdir1;
TEST mkdir $M0/subdir1;
TEST ! stat $M0/subdir2;
TEST mkdir $M0/subdir2;
TEST ! stat $M0/subdir1/subdir1.1;
TEST mkdir $M0/subdir1/subdir1.1;
TEST ! stat $M0/subdir1/subdir1.1/subdir1.2;
TEST mkdir $M0/subdir1/subdir1.1/subdir1.2;

# mount volume/subdir1
TEST $GFS --subdir-mount /subdir1 -s $H0 --volfile-id $V0 --volume-name ${V0}-dht $M1;

TEST touch $M0/topfile;
TEST ! stat $M1/topfile;

TEST touch $M1/subdir1_file;
TEST ! stat $M0/subdir1_file;
TEST stat $M0/subdir1/subdir1_file;

# mount volume/subdir2
TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M2;

TEST ! stat $M2/topfile;

TEST touch $M2/subdir2_file;
TEST ! stat $M0/subdir2_file;
TEST ! stat $M1/subdir2_file;
TEST stat $M0/subdir2/subdir2_file;

# umount $M1 / $M2
TEST umount $M1
TEST umount $M2

# mount non-existing subdir ; this works with mount.glusterfs,
# but with glusterfs, the script doesn't returns error.
#TEST ! $GFS --subdir-mount subdir_not_there -s $H0 --volfile-id $V0 $M1;

# mount subdir with depth
TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2;
TEST ! stat $M2/topfile;
TEST touch $M2/subdir1.2_file;
TEST ! stat $M0/subdir1.2_file;
TEST stat $M0/subdir1/subdir1.1/subdir1.2/subdir1.2_file;

TEST umount $M2

# Lets validate the options # Not having '*' in here as there was some
# problem with option validation with this
TEST $CLI volume set $V0 auth.allow 192.168.1.1

TEST $CLI volume set $V0 auth.allow "192.168.1.1,10.10.\*.\*,::1"

TEST $CLI volume set $V0 auth.allow "/subdir1\(1.2.3.4\),/\(192.168.10.2\|192.168.11.1\),/subdir2\(1.2.3.4\)"

# directories should be absolute
TEST ! $CLI volume set $V0 auth.allow "subdir2\(1.2.3.4\)"

# support subdir inside subdir
TEST $CLI volume set $V0 auth.allow '/subdir1/subdir1.1/subdir1.2/\(1.2.3.4\|::1\),/\(192.168.10.1\|192.168.11.1\),/subdir2\(1.2.3.4\)'

TEST $CLI volume stop $V0

TEST $CLI volume start $V0

# /subdir2 has not allowed IP
TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
TEST stat $M1

TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2
TEST stat $M2

# umount $M1 / $M2
TEST umount $M0
TEST umount $M1
TEST umount $M2


TEST $CLI volume stop $V0;
TEST $CLI volume delete $V0;
TEST ! $CLI volume info $V0;

## This should clean the mountpoints
cleanup;