glusterfs
212 строк · 7.3 Кб
1#!/bin/bash
2
3. $(dirname $0)/../include.rc
4. $(dirname $0)/../volume.rc
5. $(dirname $0)/../geo-rep.rc
6. $(dirname $0)/../env.rc
7
8SCRIPT_TIMEOUT=300
9
10#Cleanup and start glusterd
11cleanup;
12TEST glusterd;
13TEST pidof glusterd
14
15
16#Variables
17GEOREP_CLI="$CLI volume geo-replication"
18primary=$GMV0
19secondary=${H0}::${GSV0}
20secondary1=root@${H0}::${GSV1}
21num_active=2
22num_passive=2
23primary_mnt=$M0
24secondary_mnt=$M1
25
26############################################################
27#SETUP VOLUMES AND GEO-REPLICATION
28############################################################
29
30#create_and_start_primary_volume
31TEST $CLI volume create $GMV0 replica 3 $H0:$B0/${GMV0}{1,2,3};
32
33#Negative testase: Create geo-rep session, primary is not started
34TEST ! $GEOREP_CLI $primary $secondary create push-pem
35
36TEST $CLI volume start $GMV0
37
38#create_and_start_secondary_volume
39TEST $CLI volume create $GSV0 replica 3 $H0:$B0/${GSV0}{1,2,3};
40
41#Negative testcase: Create geo-rep session, secondary is not started
42TEST ! $GEOREP_CLI $primary $secondary create push-pem
43
44TEST $CLI volume start $GSV0
45
46#create_and_start_secondary1_volume
47TEST $CLI volume create $GSV1 replica 3 $H0:$B0/${GSV1}{1,2,3};
48TEST $CLI volume start $GSV1
49
50#Create, start and mount meta_volume
51TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3};
52TEST $CLI volume start $META_VOL
53TEST mkdir -p $META_MNT
54TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT
55
56#Mount primary
57TEST glusterfs -s $H0 --volfile-id $GMV0 $M0
58
59#Mount secondary
60TEST glusterfs -s $H0 --volfile-id $GSV0 $M1
61
62############################################################
63#BASIC GEO-REPLICATION GLUSTERD TESTS WITH FANOUT SETUP
64############################################################
65
66#Negative testcase: Test invalid primary
67TEST ! $GEOREP_CLI primary1 ${H0}::${GSV0} create push-pem
68
69#Negatvie testcase: Test invalid secondary
70TEST ! $GEOREP_CLI $primary ${H0}::secondary3 create push-pem
71
72##------------------- Session 1 Creation Begin-----------------##
73#Create geo-rep session
74TEST create_georep_session $primary $secondary
75
76#Config gluster-command-dir
77TEST $GEOREP_CLI $primary $secondary config gluster-command-dir ${GLUSTER_CMD_DIR}
78
79#Config gluster-command-dir
80TEST $GEOREP_CLI $primary $secondary config secondary-gluster-command-dir ${GLUSTER_CMD_DIR}
81
82#Enable_metavolume
83TEST $GEOREP_CLI $primary $secondary config use_meta_volume true
84##------------------- Session 1 Creation End-----------------##
85
86##------------------- Session 2 Creation Begin-----------------##
87#Create geo-rep session2
88TEST $GEOREP_CLI $primary $secondary1 create ssh-port 22 no-verify
89
90#Config gluster-command-dir for session2
91TEST $GEOREP_CLI $primary $secondary1 config gluster-command-dir ${GLUSTER_CMD_DIR}
92
93#Config gluster-command-dir for session2
94TEST $GEOREP_CLI $primary $secondary1 config secondary-gluster-command-dir ${GLUSTER_CMD_DIR}
95
96#Enable_metavolume for session2
97TEST $GEOREP_CLI $primary $secondary1 config use_meta_volume true
98##------------------- Session 2 Creation End-----------------##
99
100#Wait for common secret pem file to be created
101EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file
102
103#Verify the keys are distributed
104EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_keys_distributed
105
106#Start_georep
107TEST $GEOREP_CLI $primary $secondary start
108
109#check geo-rep status without specifying primary and secondary volumes
110TEST $GEOREP_CLI status
111
112#Start_georep force
113TEST $GEOREP_CLI $primary $secondary1 start force
114
115#Negative testcase: Create the same session after start, fails
116#With root@ prefix
117TEST ! $GEOREP_CLI $primary $secondary1 create push-pem
118#Without root@ prefix
119TEST ! $GEOREP_CLI $primary ${H0}::${GSV1} create push-pem
120TEST $GEOREP_CLI $primary $secondary1 create push-pem force
121
122##------------------- Fanout status testcases Begin --------------##
123EXPECT_WITHIN $GEO_REP_TIMEOUT 1 check_status_num_rows "Active"
124EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive"
125
126EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_fanout_status_num_rows "Active"
127EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_fanout_status_num_rows "Passive"
128
129EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_fanout_status_detail_num_rows "Active"
130EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_fanout_status_detail_num_rows "Passive"
131
132EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_all_status_num_rows "Active"
133EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_all_status_num_rows "Passive"
134
135EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_all_status_detail_num_rows "Active"
136EXPECT_WITHIN $GEO_REP_TIMEOUT 4 check_all_status_detail_num_rows "Passive"
137
138##------------------- Fanout status testcases End --------------##
139
140##------Checkpoint Testcase Begin---------------##
141#Write I/O
142echo "test data" > $M0/file1
143TEST $GEOREP_CLI $primary $secondary config checkpoint now
144EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_checkpoint_met $primary $secondary
145touch $M0
146EXPECT_WITHIN $GEO_REP_TIMEOUT 1 verify_checkpoint_met $primary $secondary
147##------Checkpoint Testcase End---------------##
148
149##------------------ Geo-rep config testcases Begin--------------------##
150TEST $GEOREP_CLI $primary $secondary config
151TEST ! $GEOREP_CLI $primary $secondary config arsync-options '-W'
152TEST $GEOREP_CLI $primary $secondary config rsync-options '-W'
153TEST $GEOREP_CLI $primary $secondary config rsync-options
154TEST $GEOREP_CLI $primary $secondary config \!rsync-options
155TEST $GEOREP_CLI $primary $secondary config sync-xattrs false
156##------------------ Geo-rep config testcases End --------------------##
157
158##---------------- Pause/Resume testcase Begin-------------##
159#Negative testcase: Resume geo-replication session when not paused
160TEST ! $GEOREP_CLI $primary $secondary1 resume
161TEST $GEOREP_CLI $primary $secondary1 resume force
162
163#Pause geo-replication session with root@
164TEST $GEOREP_CLI $primary $secondary1 pause force
165
166#Resume geo-replication session with root@
167TEST $GEOREP_CLI $primary $secondary1 resume force
168
169#Stop Geo-rep
170TEST $GEOREP_CLI $primary $secondary1 stop force
171
172#Negative testcase: Resume geo-replication session after geo-rep stop
173TEST ! $GEOREP_CLI $primary $secondary1 resume
174##---------------- Pause/Resume testcase End-------------##
175
176##-----------------glusterd secondary key/value upgrade testcase Begin ---------##
177#Upgrade test of secondary key stored in glusterd info file
178src=$(grep secondary2 /var/lib/glusterd/vols/$primary/info)
179#Remove secondary uuuid (last part after divided by : )
180dst=${src%:*}
181
182#Update glusterd info file with old secondary format
183sed -i "s|$src|$dst|g" /var/lib/glusterd/vols/$primary/info
184TEST ! grep $src /var/lib/glusterd/vols/$primary/info
185
186#Restart glusterd to update in-memory volinfo
187TEST pkill glusterd
188TEST glusterd;
189TEST pidof glusterd
190
191#Start geo-rep and validate secondary format is updated
192TEST $GEOREP_CLI $primary $secondary1 start force
193TEST grep $src /var/lib/glusterd/vols/$primary/info
194##-----------------glusted secondary key/value upgrade testcase End ---------##
195
196#Negative testcase: Delete Geo-rep 2 fails as geo-rep is running
197TEST ! $GEOREP_CLI $primary $secondary1 delete
198
199#Stop and Delete Geo-rep 2
200TEST $GEOREP_CLI $primary $secondary1 stop force
201TEST $GEOREP_CLI $primary $secondary1 delete reset-sync-time
202
203#Stop and Delete Geo-rep 1
204TEST $GEOREP_CLI $primary $secondary stop
205TEST $GEOREP_CLI $primary $secondary delete
206
207#Cleanup authorized keys
208sed -i '/^command=.*SSH_ORIGINAL_COMMAND#.*/d' ~/.ssh/authorized_keys
209sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys
210
211cleanup;
212#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
213