summaryrefslogtreecommitdiffstats
path: root/tests/00-geo-rep/georep-config-upgrade.t
blob: 557461cd9c4fb0bd0bf7d3baef73617f002a08d2 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash

. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../geo-rep.rc
. $(dirname $0)/../env.rc

SCRIPT_TIMEOUT=300
OLD_CONFIG_PATH=$(dirname $0)/gsyncd.conf.old
WORKING_DIR=/var/lib/glusterd/geo-replication/master_127.0.0.1_slave

##Cleanup and start glusterd
cleanup;
TEST glusterd;
TEST pidof glusterd

##Variables
GEOREP_CLI="$CLI volume geo-replication"
master=$GMV0
SH0="127.0.0.1"
slave=${SH0}::${GSV0}
num_active=2
num_passive=2
master_mnt=$M0
slave_mnt=$M1

############################################################
#SETUP VOLUMES AND GEO-REPLICATION
############################################################

##create_and_start_master_volume
TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4};
TEST $CLI volume start $GMV0

##create_and_start_slave_volume
TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4};
TEST $CLI volume start $GSV0

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

##Mount master
TEST glusterfs -s $H0 --volfile-id $GMV0 $M0

##Mount slave
TEST glusterfs -s $H0 --volfile-id $GSV0 $M1

############################################################
#BASIC GEO-REPLICATION TESTS
############################################################

#Create geo-rep session
TEST create_georep_session $master $slave

#Config gluster-command-dir
TEST $GEOREP_CLI $master $slave config gluster-command-dir ${GLUSTER_CMD_DIR}

#Config gluster-command-dir
TEST $GEOREP_CLI $master $slave config slave-gluster-command-dir ${GLUSTER_CMD_DIR}

#Enable_metavolume
TEST $GEOREP_CLI $master $slave config use_meta_volume true

#Wait for common secret pem file to be created
EXPECT_WITHIN $GEO_REP_TIMEOUT  0 check_common_secret_file

#Verify the keys are distributed
EXPECT_WITHIN $GEO_REP_TIMEOUT  0 check_keys_distributed

#Start_georep
TEST $GEOREP_CLI $master $slave start

EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_status_num_rows "Active"
EXPECT_WITHIN $GEO_REP_TIMEOUT  2 check_status_num_rows "Passive"

TEST $GEOREP_CLI $master $slave config sync-method tarssh

#Stop Geo-rep
TEST $GEOREP_CLI $master $slave stop

#Copy old config file
mv -f $WORKING_DIR/gsyncd.conf $WORKING_DIR/gsyncd.conf.org
cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf

#Check if config get all updates config_file
TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
TEST $GEOREP_CLI $master $slave config
TEST grep "sync-method" $WORKING_DIR/gsyncd.conf

#Check if config get updates config_file
rm -f $WORKING_DIR/gsyncd.conf
cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
TEST $GEOREP_CLI $master $slave config sync-method
TEST grep "sync-method" $WORKING_DIR/gsyncd.conf

#Check if config set updates config_file
rm -f $WORKING_DIR/gsyncd.conf
cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
TEST $GEOREP_CLI $master $slave config sync-xattrs false
TEST grep "sync-method" $WORKING_DIR/gsyncd.conf

#Check if config reset updates config_file
rm -f $WORKING_DIR/gsyncd.conf
cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
TEST $GEOREP_CLI $master $slave config \!sync-xattrs
TEST grep "sync-method" $WORKING_DIR/gsyncd.conf

#Check if geo-rep start updates config_file
rm -f $WORKING_DIR/gsyncd.conf
cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
TEST $GEOREP_CLI $master $slave start
TEST grep "sync-method" $WORKING_DIR/gsyncd.conf

#Stop geo-rep
TEST $GEOREP_CLI $master $slave stop

#Delete Geo-rep
TEST $GEOREP_CLI $master $slave delete

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

cleanup;
#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000