]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_multi.py: finer control for bringing up system
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 16 Dec 2015 00:00:12 +0000 (16:00 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:45 +0000 (16:13 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/test/rgw/test-rgw-common.sh
src/test/rgw/test-rgw-meta-sync.sh
src/test/rgw/test-rgw-multisite.sh

index 3729098eeea1e089e2124c7882437ebe016ccf92..d81b6426e37f48638ea57c4b953e9be08713c83b 100644 (file)
@@ -65,7 +65,7 @@ function start_ceph_cluster {
 }
 
 function rgw_admin {
-  [ $# -ne 1 ] && echo "rgw_admin() needs 1 param" && exit 1
+  [ $# -lt 1 ] && echo "rgw_admin() needs 1 param" && exit 1
 
   echo "$mrun c$1 radosgw-admin"
 }
@@ -102,21 +102,28 @@ function init_first_zone {
 }
 
 function init_zone_in_existing_zg {
-  [ $# -ne 7 ] && echo "init_zone_in_existing_zg() needs 7 params" && exit 1
+  [ $# -ne 8 ] && echo "init_zone_in_existing_zg() needs 8 params" && exit 1
 
   id=$1
   realm=$2
   zg=$3
   zone=$4
-  port=$5
+  zone1_port=$5
+  port=$6
 
-  access_key=$6
-  secret=$7
+  access_key=$7
+  secret=$8
 
-  x $(rgw_admin $id) realm pull --url=http://localhost:$zone1_port --access-key=${system_access_key} --secret=${system_secret} --default
+  x $(rgw_admin $id) realm pull --url=http://localhost:$zone1_port --access-key=${access_key} --secret=${secret} --default
   x $(rgw_admin $id) zonegroup default --rgw-zonegroup=$zg
-  x $(rgw_admin $id) zone create --rgw-zonegroup=$zg --rgw-zone=$zone2 --access-key=${system_access_key} --secret=${system_secret} --endpoints=http://localhost:$zone2_port
+  x $(rgw_admin $id) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=http://localhost:$port
   x $(rgw_admin $id) period update --commit
 
-  x $(rgw $id $zone2_port) --rgw-zone=$zone2
+  x $(rgw $id $port) --rgw-zone=$zone
+}
+
+function call_rgw_admin {
+  c=$1
+  shift
+  x $(rgw_admin $c) "$@"
 }
index 90b45934f4f1530d382ebd3bc728b55d6aaf8b0d..fe3ace2de54619536924ac84d4dcb42c2d8c8e03 100755 (executable)
@@ -18,7 +18,7 @@ function get_metadata_sync_status {
 
   num_shards2=$(python_array_len $sync_markers)
 
-  [ "$global_sync_status" == "sync" ] && assert $num_shards2 -eq $num_shards
+  [ "$global_sync_status" == "sync" ] && $assert $num_shards2 -eq $num_shards
 
   sync_states=$(project_python_array_field val.state $sync_markers)
   eval secondary_status=$(project_python_array_field val.marker $sync_markers)
index 337b21725ce734a469c64531f47038bc5e1850bb..32d3648de7909748dda7768826bb471dbf002955 100755 (executable)
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+[ $# -lt 1 ] && echo "usage: $0 <num-clusters>" && exit 1
+
+num_clusters=$1
+
+[ $num_clusters -lt 1 ] && echo "clusters num must be at least 1" && exit 1
+
 . "`dirname $0`/test-rgw-common.sh"
 . "`dirname $0`/test-rgw-meta-sync.sh"
 
@@ -7,11 +13,13 @@ set -e
 
 realm_name=earth
 zg=us
-zone1=${zg}-1
-zone2=${zg}-2
 
-zone1_port=8000
-zone2_port=8001
+i=1
+while [ $i -le $num_clusters ]; do
+  eval zone$i=${zg}-$i
+  eval zone${i}_port=$((8000+$i))
+  i=$((i+1))
+done
 
 system_access_key="1234567890"
 system_secret="pencil"
@@ -26,18 +34,22 @@ output=`$(rgw_admin 1) realm get`
 
 echo realm_status=$output
 
-# bring up second cluster
-x $(start_ceph_cluster 2) -n
-
+# bring up next clusters
 
-# create new zone, start rgw
-init_zone_in_existing_zg 2 $realm_name $zg $zone1 $zone1_port $system_access_key $system_secret
+i=2
+while [ $i -le $num_clusters ]; do
+  x $(start_ceph_cluster $i) -n
 
 
-wait_for_meta_sync 1 2
+  # create new zone, start rgw
+  zone_port=eval echo '$'zone${i}_port
+  init_zone_in_existing_zg $i $realm_name $zg $zone1 $zone1_port $zone_port $system_access_key $system_secret
 
-$(rgw_admin 1) user create --uid=user1 --display-name='user one' --secret=user1secret --access-key=USER1ACCESSKEY
-$(rgw_admin 1) user create --uid=user2 --display-name='user two' --secret=user2secret --access-key=USER2ACCESSKEY
+  i=$((i+1))
+done
 
-wait_for_meta_sync 1 2
+i=2
+while [ $i -le $num_clusters ]; do
+  wait_for_meta_sync 1 $i
+done