From dfede47ad9746d87684c568b267c0d83966236cf Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 31 Mar 2015 11:51:32 +0200 Subject: [PATCH] First take on integration test for using on devstack Change-Id: Ie9a3f7b6ac9b3560c4d001739cae4a3b65176abf Implements: blueprint devstack-plugin --- functest/devstack-test.sh | 49 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 functest/devstack-test.sh diff --git a/functest/devstack-test.sh b/functest/devstack-test.sh new file mode 100755 index 000000000..6abd445df --- /dev/null +++ b/functest/devstack-test.sh @@ -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