diff --git a/dev/functions b/dev/functions index f5264c50e..2a8e2ebc9 100644 --- a/dev/functions +++ b/dev/functions @@ -215,3 +215,24 @@ function overcloud_deploy { echo "Control plane deployment complete" } + +function overcloud_test { + # Perform a simple smoke test against the cloud. + echo "Performing a simple smoke test" + + environment_setup + + pip install python-openstackclient + + echo "Running kolla-ansible init-runonce" + source "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" + ${KOLLA_VENV_PATH:-$HOME/kolla-venv}/share/kolla-ansible/init-runonce + + echo "Creating a VM" + openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net demo1 + openstack server show demo1 + # TODO(mgoddard): Test SSH connectivity to the VM. + + echo "Deleting the VM" + openstack server delete --wait demo1 +} diff --git a/dev/overcloud-test.sh b/dev/overcloud-test.sh new file mode 100755 index 000000000..b27e2fab8 --- /dev/null +++ b/dev/overcloud-test.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -eu +set -o pipefail + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + config_init + overcloud_test +} + +main diff --git a/playbooks/kayobe-overcloud-base/run.yml b/playbooks/kayobe-overcloud-base/run.yml index 3d09ea500..a5f1a442f 100644 --- a/playbooks/kayobe-overcloud-base/run.yml +++ b/playbooks/kayobe-overcloud-base/run.yml @@ -8,3 +8,8 @@ shell: cmd: dev/overcloud-deploy.sh > {{ logs_dir }}/ansible/overcloud-deploy chdir: "{{ kayobe_src_dir }}" + + - name: Perform testing of the overcloud + shell: + cmd: dev/overcloud-test.sh > {{ logs_dir }}/ansible/overcloud-test + chdir: "{{ kayobe_src_dir }}"