First take on integration test for using on devstack

Change-Id: Ie9a3f7b6ac9b3560c4d001739cae4a3b65176abf
Implements: blueprint devstack-plugin
This commit is contained in:
Dmitry Tantsur 2015-03-31 11:51:32 +02:00
parent a0884628cb
commit dfede47ad9
1 changed files with 49 additions and 0 deletions

49
functest/devstack-test.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
set -eux
INTROSPECTION_SLEEP=${INTROSPECTION_SLEEP:-30}
nodes=$(ironic node-list | tail -n +4 | head -n -1 | tr '|' ' ' | awk '{ print $1; }')
if [ -z "$nodes" ]; then
echo "No nodes found in Ironic"
exit 1
fi
for uuid in $nodes; do
for p in cpus cpu_arch memory_mb local_gb; do
ironic node-update $uuid remove properties/$p > /dev/null
done
done
for uuid in $nodes; do
# TODO(dtantsur): use Ironic API instead
openstack baremetal introspection start $uuid
done
current_nodes=$nodes
temp_nodes=
while true; do
sleep $INTROSPECTION_SLEEP
for uuid in $current_nodes; do
finished=$(openstack baremetal introspection status $uuid -f value -c finished)
if [ "$finished" = "True" ]; then
error=$(openstack baremetal introspection status $uuid -f value -c error)
if [ "$error" != "None" ]; then
echo "Introspection for $uuid failed: $error"
exit 1
fi
else
temp_nodes="$temp_nodes $uuid"
fi
done
if [ "$temp_nodes" = "" ]; then
echo "Introspection done"
break
else
current_nodes=$temp_nodes
temp_nodes=
fi
done
# TODO(dtantsur): check results