Use openstack command in CI
Switch the CI test script to use the openstack command rather than nova etc. Change-Id: Id1c6d35e1e50987d230adb7942da6a7ae5c0f050
This commit is contained in:
parent
4f21133ac4
commit
07d5351812
@ -7,28 +7,65 @@ set -o errexit
|
|||||||
export PYTHONUNBUFFERED=1
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
|
||||||
function test_openstack {
|
function test_openstack_logged {
|
||||||
# Wait for service ready
|
# Wait for service ready
|
||||||
sleep 15
|
sleep 15
|
||||||
. /etc/kolla/admin-openrc.sh
|
|
||||||
nova --debug service-list
|
|
||||||
openstack --debug network agent list
|
|
||||||
tools/init-runonce
|
|
||||||
nova --debug boot --poll --image $(openstack image list | awk '/cirros/ {print $2}') --nic net-id=$(openstack network list | awk '/demo-net/ {print $2}') --flavor 1 kolla_boot_test
|
|
||||||
|
|
||||||
nova --debug list
|
. /etc/kolla/admin-openrc.sh
|
||||||
|
|
||||||
|
openstack --debug compute service list
|
||||||
|
openstack --debug network agent list
|
||||||
|
|
||||||
|
if ! openstack image show cirros >/dev/null 2>&1; then
|
||||||
|
echo "Initialising OpenStack resources via init-runonce"
|
||||||
|
tools/init-runonce
|
||||||
|
else
|
||||||
|
echo "Not running init-runonce - resources exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "TESTING: Server creation"
|
||||||
|
openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net kolla_boot_test
|
||||||
|
openstack --debug server list
|
||||||
# If the status is not ACTIVE, print info and exit 1
|
# If the status is not ACTIVE, print info and exit 1
|
||||||
nova --debug show kolla_boot_test | awk '{buf=buf"\n"$0} $2=="status" && $4!="ACTIVE" {failed="yes"}; END {if (failed=="yes") {print buf; exit 1}}'
|
if [[ $(openstack server show kolla_boot_test -f value -c status) != "ACTIVE" ]]; then
|
||||||
|
echo "FAILED: Instance is not active"
|
||||||
|
openstack --debug server show kolla_boot_test
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "SUCCESS: Server creation"
|
||||||
|
|
||||||
if echo $ACTION | grep -q "ceph"; then
|
if echo $ACTION | grep -q "ceph"; then
|
||||||
|
echo "TESTING: Cinder volume attachment"
|
||||||
openstack volume create --size 2 test_volume
|
openstack volume create --size 2 test_volume
|
||||||
openstack server add volume kolla_boot_test test_volume --device /dev/vdb
|
openstack server add volume kolla_boot_test test_volume --device /dev/vdb
|
||||||
|
openstack server remove volume kolla_boot_test test_volume
|
||||||
|
echo "SUCCESS: Cinder volume attachment"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "TESTING: Server deletion"
|
||||||
|
openstack server delete --wait kolla_boot_test
|
||||||
|
echo "SUCCESS: Server deletion"
|
||||||
|
|
||||||
if echo $ACTION | grep -q "zun"; then
|
if echo $ACTION | grep -q "zun"; then
|
||||||
|
echo "TESTING: Zun"
|
||||||
openstack --debug appcontainer service list
|
openstack --debug appcontainer service list
|
||||||
openstack --debug appcontainer host list
|
openstack --debug appcontainer host list
|
||||||
# TODO(hongbin): Run a Zun container and assert the container becomes
|
# TODO(hongbin): Run a Zun container and assert the container becomes
|
||||||
# Running
|
# Running
|
||||||
|
echo "SUCCESS: Zun"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_openstack {
|
||||||
|
echo "Testing OpenStack"
|
||||||
|
test_openstack_logged > /tmp/logs/ansible/test-openstack 2>&1
|
||||||
|
result=$?
|
||||||
|
if [[ $result != 0 ]]; then
|
||||||
|
echo "Testing OpenStack failed. See ansible/test-openstack for details"
|
||||||
|
else
|
||||||
|
echo "Successfully tested OpenStack. See ansible/test-openstack for details"
|
||||||
|
fi
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
test_openstack
|
test_openstack
|
||||||
|
Loading…
Reference in New Issue
Block a user