Change some static values to dynamic and add minimal test config

Also fixed some typos and add teardown after test

Change-Id: If279d8c59d32a6eef0e6dded726ead99d4c644e6
This commit is contained in:
zhaoxinyu 2014-04-03 23:16:17 +00:00
parent a9cd5c600b
commit a60b5d2ccd
8 changed files with 75 additions and 42 deletions

View File

@ -77,13 +77,11 @@ flags.add('host_roles',
),
default='')
flags.add('deployment_timeout',
type='int',
help='deployment timeout',
default=60 * 60)
help='deployment timeout in minutes',
default=60)
flags.add('progress_update_check_interval',
type='int',
help='progress update status check interval',
default=30)
help='progress update status check interval in seconds',
default=60)
flags.add('dashboard_role',
help='dashboard role name',
default='os-dashboard')
@ -447,7 +445,7 @@ def _deploy_clusters(client, cluster_hosts):
def _get_installing_progress(client, cluster_hosts):
"""get intalling progress."""
timeout = time.time() + flags.OPTIONS.deployment_timeout
timeout = time.time() + 60 * float(flags.OPTIONS.deployment_timeout)
clusters_progress = {}
hosts_progress = {}
install_finished = False
@ -510,7 +508,7 @@ def _get_installing_progress(client, cluster_hosts):
'there are some clusters/hosts in installing.'
'sleep %s seconds and retry',
flags.OPTIONS.progress_update_check_interval)
time.sleep(flags.OPTIONS.progress_update_check_interval)
time.sleep(float(flags.OPTIONS.progress_update_check_interval))
else:
install_finished = True
logging.info('all clusters/hosts are installed.')

View File

@ -285,6 +285,8 @@ status, resp = client.get_dashboard_links(cluster_id)
print 'get cluster %s dashboardlinks status: %s, resp: %s' % (
cluster_id, status, resp)
dashboardlinks = resp['dashboardlinks']
if not dashboardlinks.keys():
raise Exception("Dashboard link is not found!")
for x in dashboardlinks.keys():
if x in ("os-dashboard", "os-controller"):
dashboardurl = dashboardlinks.get(x)

View File

@ -136,6 +136,7 @@ if [ "$tempest" == "true" ]; then
git clean -x -f -d -q
git checkout grizzly-eol
fi
cd /tmp/tempest
pip install -e .
fi

View File

@ -68,7 +68,7 @@ fi
#Initialize cloud environment for test and Tempest config file
cp etc/tempest.conf.sample /etc/tempest/tempest.conf
nova_api_host=`knife data bag show openstack openstack_1 | shyaml get-value endpoints.compute.service.host`
sshpass -p 'root' scp -o StrictHostKeyChecking=no -r root@$nova_api_host:/root/openrc /root/.
sshpass -p 'root' scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r root@$nova_api_host:/root/openrc /root/.
source /root/openrc
demo_tenant_id=`keystone tenant-create --name demo |grep " id " |awk '{print $4}'`
alt_demo_tenant_id=`keystone tenant-create --name alt_demo |grep " id " |awk '{print $4}'`
@ -98,7 +98,7 @@ iniset /etc/tempest/tempest.conf network public_router_id ''
iniset /etc/tempest/tempest.conf network quantum_available true
#Start a smoke test against cloud without object storage and aws related tests
#as they are unavailable for now
if [ $tempest_full == true ]; then
if [[ $tempest_full == true ]]; then
nosetests --logging-format '%(asctime)-15s %(message)s' --with-xunit -sv --attr=type=smoke \
--xunit-file=nosetests-smoke.xml tempest -e object_storage -e boto
else

View File

@ -10,9 +10,9 @@ export SWITCH_CREDENTIAL=${SWITCH_CREDENTIAL:-"version=${SWITCH_VERSION},communi
export HOST_ROLES=${HOST_ROLES:-''}
export MANAGEMENT_IP_START=${MANAGEMENT_IP_START:-'172.16.1.1'}
export MANAGEMENT_IP_END=${MANAGEMENT_IP_END:-'172.16.1.254'}
export MANAGEMENT_NETMASK=${MANAGEMENT_NETMASK:-'255.255.0.0'}
export MANAGEMENT_IP_START=${MANAGEMENT_IP_START:-`echo $ipaddr |cut -d. -f'1 2 3'`.10}
export MANAGEMENT_IP_END=${MANAGEMENT_IP_END:-`echo $ipaddr |cut -d. -f'1 2 3'`.100}
export MANAGEMENT_NETMASK=${MANAGEMENT_NETMASK:-'255.255.255.0'}
export MANAGEMENT_NIC=${MANAGEMENT_NIC:-'eth0'}
export MANAGEMENT_PROMISC=${MANAGEMENT_PROMISC:-'0'}
export TENANT_IP_START=${TENANT_IP_START:-'172.16.2.1'}
@ -30,10 +30,10 @@ export STORAGE_IP_END=${STORAGE_IP_END:-'172.16.4.254'}
export STORAGE_NETMASK=${STORAGE_NETMASK:-'255.255.255.0'}
export STORAGE_NIC=${STORAGE_NIC:-'eth3'}
export STORAGE_PROMISC=${STORAGE_PROMISC:-'0'}
export NAMESERVERS=${NAMESERVERS:-'172.16.0.1'}
export NTP_SERVER=${NTP_SERVER:-'172.16.0.1'}
export GATEWAY=${GATEWAY:-'172.16.0.1'}
export PROXY=${PROXY:-"http://172.16.0.1:3128"}
export NAMESERVERS=${NAMESERVERS:-$ipaddr}
export NTP_SERVER=${NTP_SERVER:-$ipaddr}
export GATEWAY=${GATEWAY:-$ipaddr}
export PROXY=${PROXY:-http://$ipaddr:3128}
export SEARCH_PATH=${SEARCH_PATH:-'ods.com'}
export HA_VIP=${HA_VIP:-''}
export NETWORKING=${NETWORKING:-"nameservers=$NAMESERVERS;search_path=$SEARCH_PATH;gateway=$GATEWAY;proxy=$PROXY;ntp_server=$NTP_SERVER;ha_vip=$HA_VIP;management_ip_start=$MANAGEMENT_IP_START;management_ip_end=$MANAGEMENT_IP_END;management_netmask=$MANAGEMENT_NETMASK;management_gateway=;management_nic=$MANAGEMENT_NIC;management_promisc=$MANAGEMENT_PROMISC;tenant_ip_start=$TENANT_IP_START;tenant_ip_end=$TENANT_IP_END;tenant_netmask=$TENANT_NETMASK;tenant_gateway=;tenant_nic=$TENANT_NIC;tenant_promisc=$TENANT_PROMISC;public_ip_start=$PUBLIC_IP_START;public_ip_end=$PUBLIC_IP_END;public_netmask=$PUBLIC_NETMASK;public_gateway=;public_nic=$PUBLIC_NIC;public_promisc=$PUBLIC_PROMISC;storage_ip_start=$STORAGE_IP_START;storage_ip_end=$STORAGE_IP_END;storage_netmask=$STORAGE_NETMASK;storage_gateway=;storage_nic=$STORAGE_NIC;storage_promisc=$STORAGE_PROMISC"}
@ -52,3 +52,4 @@ export CONSOLE_PASSWORD=${CONSOLE_PASSWORD:-console}
export SECURITY=${SECURITY:-"server:${SERVER_USERNAME}=${SERVER_PASSWORD},service:${SERVICE_USERNAME}=${SERVICE_PASSWORD},console:${CONSOLE_USERNAME}=${CONSOLE_PASSWORD}"}
export DASHBOARD_ROLE=${DASHBOARD_ROLE:-"os-controller"}
export DEPLOYMENT_TIMEOUT=${DEPLOYMENT_TIMEOUT:-"90"}

View File

@ -11,6 +11,27 @@ function mac_address() {
echo "00:00:$(mac_address_part):$(mac_address_part):$(mac_address_part):$(mac_address_part)"
}
function tear_down_machines() {
virtmachines=$(virsh list --name)
for virtmachine in $virtmachines; do
echo "destroy $virtmachine"
virsh destroy $virtmachine
if [[ "$?" != "0" ]]; then
echo "destroy instance $virtmachine failed"
exit 1
fi
done
virtmachines=$(virsh list --all --name)
for virtmachine in $virtmachines; do
echo "undefine $virtmachine"
virsh undefine $virtmachine
if [[ "$?" != "0" ]]; then
echo "undefine instance $virtmachine failed"
exit 1
fi
done
}
REGTEST_CONF=${REGTEST_CONF:-"regtest.conf"}
REGTEST_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${REGTEST_DIR}/${REGTEST_CONF}
@ -25,24 +46,7 @@ echo "role list: ${roles_list[@]}"
roles_offset=0
host_roles_list=''
virtmachines=$(virsh list --name)
for virtmachine in $virtmachines; do
echo "destroy $virtmachine"
virsh destroy $virtmachine
if [[ "$?" != "0" ]]; then
echo "destroy instance $virtmachine failed"
exit 1
fi
done
virtmachines=$(virsh list --all --name)
for virtmachine in $virtmachines; do
echo "undefine $virtmachine"
virsh undefine $virtmachine
if [[ "$?" != "0" ]]; then
echo "undefine instance $virtmachine failed"
exit 1
fi
done
tear_down_machines
echo "setup $VIRT_NUM virt machines"
for i in `seq $VIRT_NUM`; do
@ -71,7 +75,7 @@ for i in `seq $VIRT_NUM`; do
--network=bridge:installation \
--name pxe${i} --ram=${VIRT_MEM} \
--disk /tmp/pxe${i}.raw,format=raw \
--vcpus=${VIRT_CPU} \
--vcpus=${VIRT_CPUS} \
--graphics vnc,listen=0.0.0.0 \
--noautoconsole \
--autostart \
@ -125,8 +129,13 @@ echo "machines: $machines"
echo "host roles: $host_roles_list"
virsh list
ln -sf /var/log/cobbler/anamon cobbler_logs
ln -sf /var/log/compass compass_logs
# Avoid infinite relative symbolic links
if [[ ! -L cobbler_logs ]]; then
ln -s /var/log/cobbler/anamon cobbler_logs
fi
if [[ ! -L compass_logs ]]; then
ln -s /var/log/compass compass_logs
fi
CLIENT_SCRIPT=/opt/compass/bin/client.py
/opt/compass/bin/refresh.sh
if [[ "$?" != "0" ]]; then
@ -134,8 +143,20 @@ if [[ "$?" != "0" ]]; then
exit 1
fi
${CLIENT_SCRIPT} --logfile= --loglevel=info --logdir= --networking="${NETWORKING}" --partitions="${PARTITION}" --credentials="${SECURITY}" --host_roles="${host_roles_list}" --dashboard_role="${DASHBOARD_ROLE}" --switch_ips="${SWITCH_IPS}" --machines="${machines}" --switch_credential="${SWITCH_CREDENTIAL}"
if [[ "$?" != "0" ]]; then
echo "deploy cluster failed"
${CLIENT_SCRIPT} --logfile= --loglevel=info --logdir= --networking="${NETWORKING}" --partitions="${PARTITION}" --credentials="${SECURITY}" --host_roles="${host_roles_list}" --dashboard_role="${DASHBOARD_ROLE}" --switch_ips="${SWITCH_IPS}" --machines="${machines}" --switch_credential="${SWITCH_CREDENTIAL}" --deployment_timeout="${DEPLOYMENT_TIMEOUT}"
rc=$?
# Tear down machines after the test
if [[ $rc != 0 ]]; then
tear_down_machines
echo "deployment failed"
exit 1
fi
if [[ $tempest == true ]]; then
./tempest_run.sh
if [[ $? != 0 ]]; then
tear_down_machines
echo "tempest failed"
exit 1
fi
tear_down_machines
fi

View File

@ -4,7 +4,7 @@ export VIRT_CPUS=${VIRT_CPUS:-'4'}
export VIRT_MEM=${VIRT_MEM:-'6144'}
export VIRT_DISK=${VIRT_DISK:-'20G'}
export HOST_ROLES=${HOST_ROLES:-'os-controller,os-image;os-ops-database,os-ops-messaging;os-network,os-block-storage-worker;os-ha;os-ha'}
export HA_VIP=${HA_VIP:-'172.16.1.253'}
export HA_VIP=${HA_VIP:-`echo $ipaddr |cut -d. -f'1 2 3'`.253}
REGTEST_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${REGTEST_DIR}/regtest.conf

View File

@ -0,0 +1,10 @@
# Set test script variables
export VIRT_NUM=${VIRT_NUM:-'1'}
export VIRT_CPUS=${VIRT_CPUS:-'10'}
export VIRT_MEM=${VIRT_MEM:-'8192'}
export VIRT_DISK=${VIRT_DISK:-'20G'}
export HOST_ROLES=${HOST_ROLES:-'os-dashboard'}
export DASHBOARD_ROLE=${DASHBOARD_ROLE:-"os-dashboard"}
export DEPLOYMENT_TIMEOUT=${DEPLOYMENT_TIMEOUT:-'60'}
REGTEST_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source ${REGTEST_DIR}/regtest.conf