glusterfs

Форк
0
/
01-georep-glusterd-tests.t 
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

8
SCRIPT_TIMEOUT=300
9

10
#Cleanup and start glusterd
11
cleanup;
12
TEST glusterd;
13
TEST pidof glusterd
14

15

16
#Variables
17
GEOREP_CLI="$CLI volume geo-replication"
18
primary=$GMV0
19
secondary=${H0}::${GSV0}
20
secondary1=root@${H0}::${GSV1}
21
num_active=2
22
num_passive=2
23
primary_mnt=$M0
24
secondary_mnt=$M1
25

26
############################################################
27
#SETUP VOLUMES AND GEO-REPLICATION
28
############################################################
29

30
#create_and_start_primary_volume
31
TEST $CLI volume create $GMV0 replica 3 $H0:$B0/${GMV0}{1,2,3};
32

33
#Negative testase: Create geo-rep session, primary is not started
34
TEST ! $GEOREP_CLI $primary $secondary create push-pem
35

36
TEST $CLI volume start $GMV0
37

38
#create_and_start_secondary_volume
39
TEST $CLI volume create $GSV0 replica 3 $H0:$B0/${GSV0}{1,2,3};
40

41
#Negative testcase: Create geo-rep session, secondary is not started
42
TEST ! $GEOREP_CLI $primary $secondary create push-pem
43

44
TEST $CLI volume start $GSV0
45

46
#create_and_start_secondary1_volume
47
TEST $CLI volume create $GSV1 replica 3 $H0:$B0/${GSV1}{1,2,3};
48
TEST $CLI volume start $GSV1
49

50
#Create, start and mount meta_volume
51
TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3};
52
TEST $CLI volume start $META_VOL
53
TEST mkdir -p $META_MNT
54
TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT
55

56
#Mount primary
57
TEST glusterfs -s $H0 --volfile-id $GMV0 $M0
58

59
#Mount secondary
60
TEST 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
67
TEST ! $GEOREP_CLI primary1 ${H0}::${GSV0} create push-pem
68

69
#Negatvie testcase: Test invalid secondary
70
TEST ! $GEOREP_CLI $primary ${H0}::secondary3 create push-pem
71

72
##------------------- Session 1 Creation Begin-----------------##
73
#Create geo-rep session
74
TEST create_georep_session $primary $secondary
75

76
#Config gluster-command-dir
77
TEST $GEOREP_CLI $primary $secondary config gluster-command-dir ${GLUSTER_CMD_DIR}
78

79
#Config gluster-command-dir
80
TEST $GEOREP_CLI $primary $secondary config secondary-gluster-command-dir ${GLUSTER_CMD_DIR}
81

82
#Enable_metavolume
83
TEST $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
88
TEST $GEOREP_CLI $primary $secondary1 create ssh-port 22 no-verify
89

90
#Config gluster-command-dir for session2
91
TEST $GEOREP_CLI $primary $secondary1 config gluster-command-dir ${GLUSTER_CMD_DIR}
92

93
#Config gluster-command-dir for session2
94
TEST $GEOREP_CLI $primary $secondary1 config secondary-gluster-command-dir ${GLUSTER_CMD_DIR}
95

96
#Enable_metavolume for session2
97
TEST $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
101
EXPECT_WITHIN $GEO_REP_TIMEOUT  0 check_common_secret_file
102

103
#Verify the keys are distributed
104
EXPECT_WITHIN $GEO_REP_TIMEOUT  0 check_keys_distributed
105

106
#Start_georep
107
TEST $GEOREP_CLI $primary $secondary start
108

109
#check geo-rep status without specifying primary and secondary volumes
110
TEST $GEOREP_CLI status
111

112
#Start_georep force
113
TEST $GEOREP_CLI $primary $secondary1 start force
114

115
#Negative testcase: Create the same session after start, fails
116
#With root@ prefix
117
TEST ! $GEOREP_CLI $primary $secondary1 create push-pem
118
#Without root@ prefix
119
TEST ! $GEOREP_CLI $primary ${H0}::${GSV1} create push-pem
120
TEST $GEOREP_CLI $primary $secondary1 create push-pem force
121

122
##------------------- Fanout status testcases Begin --------------##
123
EXPECT_WITHIN $GEO_REP_TIMEOUT  1 check_status_num_rows "Active"
124
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_status_num_rows "Passive"
125

126
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_fanout_status_num_rows "Active"
127
EXPECT_WITHIN $GEO_REP_TIMEOUT  4 check_fanout_status_num_rows "Passive"
128

129
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_fanout_status_detail_num_rows "Active"
130
EXPECT_WITHIN $GEO_REP_TIMEOUT  4 check_fanout_status_detail_num_rows "Passive"
131

132
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_all_status_num_rows "Active"
133
EXPECT_WITHIN $GEO_REP_TIMEOUT  4 check_all_status_num_rows "Passive"
134

135
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_all_status_detail_num_rows "Active"
136
EXPECT_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
142
echo "test data" > $M0/file1
143
TEST $GEOREP_CLI $primary $secondary config checkpoint now
144
EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_checkpoint_met $primary $secondary
145
touch $M0
146
EXPECT_WITHIN $GEO_REP_TIMEOUT 1 verify_checkpoint_met $primary $secondary
147
##------Checkpoint Testcase End---------------##
148

149
##------------------ Geo-rep config testcases Begin--------------------##
150
TEST $GEOREP_CLI $primary $secondary config
151
TEST ! $GEOREP_CLI $primary $secondary config arsync-options '-W'
152
TEST $GEOREP_CLI $primary $secondary config rsync-options '-W'
153
TEST $GEOREP_CLI $primary $secondary config rsync-options
154
TEST $GEOREP_CLI $primary $secondary config \!rsync-options
155
TEST $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
160
TEST ! $GEOREP_CLI  $primary $secondary1 resume
161
TEST $GEOREP_CLI  $primary $secondary1 resume force
162

163
#Pause geo-replication session with root@
164
TEST $GEOREP_CLI $primary $secondary1 pause force
165

166
#Resume geo-replication session with root@
167
TEST $GEOREP_CLI $primary $secondary1 resume force
168

169
#Stop Geo-rep
170
TEST $GEOREP_CLI $primary $secondary1 stop force
171

172
#Negative testcase: Resume geo-replication session after geo-rep stop
173
TEST ! $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
178
src=$(grep secondary2 /var/lib/glusterd/vols/$primary/info)
179
#Remove secondary uuuid (last part after divided by : )
180
dst=${src%:*}
181

182
#Update glusterd info file with old secondary format
183
sed -i "s|$src|$dst|g" /var/lib/glusterd/vols/$primary/info
184
TEST ! grep $src /var/lib/glusterd/vols/$primary/info
185

186
#Restart glusterd to update in-memory volinfo
187
TEST pkill glusterd
188
TEST glusterd;
189
TEST pidof glusterd
190

191
#Start geo-rep and validate secondary format is updated
192
TEST $GEOREP_CLI $primary $secondary1 start force
193
TEST 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
197
TEST ! $GEOREP_CLI $primary $secondary1 delete
198

199
#Stop and Delete Geo-rep 2
200
TEST $GEOREP_CLI $primary $secondary1 stop force
201
TEST $GEOREP_CLI $primary $secondary1 delete reset-sync-time
202

203
#Stop and Delete Geo-rep 1
204
TEST $GEOREP_CLI $primary $secondary stop
205
TEST $GEOREP_CLI $primary $secondary delete
206

207
#Cleanup authorized keys
208
sed -i '/^command=.*SSH_ORIGINAL_COMMAND#.*/d' ~/.ssh/authorized_keys
209
sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys
210

211
cleanup;
212
#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
213

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.