From c0358d0bd5918ffd64c1fa04050ac34fa06791fa Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Wed, 20 May 2015 11:06:46 -0700 Subject: [PATCH] Create clouds.yaml for functional tests Change-Id: I5d6d0c587b65e0ca877a4d13c89c4cd6ac90ef50 --- create_yaml.sh | 30 +++++++++++++++++++ .../functional/orchestration/v1/test_stack.py | 9 ++++-- post_test_hook.sh | 4 ++- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100755 create_yaml.sh diff --git a/create_yaml.sh b/create_yaml.sh new file mode 100755 index 000000000..3da207841 --- /dev/null +++ b/create_yaml.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# NOTE(thowe): There are some issues with OCC envvars that force us to do +# this for now. +# +mkdir -p ~/.config/openstack/ +FILE=~/.config/openstack/clouds.yaml +echo 'clouds:' >$FILE +echo ' test_cloud:' >>$FILE +env | grep OS_ | tr '=' ' ' | while read k v +do + k=$(echo $k | sed -e 's/OS_//') + k=$(echo $k | tr '[A-Z]' '[a-z]') + case "$k" in + region_name|*_api_version) + echo " $k: $v" >>$FILE + esac +done +echo " auth:" >>$FILE +env | grep OS_ | tr '=' ' ' | while read k v +do + k=$(echo $k | sed -e 's/OS_//') + k=$(echo $k | tr '[A-Z]' '[a-z]') + case "$k" in + region_name|*_api_version) + ;; + *) + echo " $k: $v" >>$FILE + esac +done diff --git a/openstack/tests/functional/orchestration/v1/test_stack.py b/openstack/tests/functional/orchestration/v1/test_stack.py index 8d1852fc3..7fa68b40f 100644 --- a/openstack/tests/functional/orchestration/v1/test_stack.py +++ b/openstack/tests/functional/orchestration/v1/test_stack.py @@ -24,11 +24,16 @@ class TestStack(base.BaseFunctionalTest): super(TestStack, cls).setUpClass() if cls.conn.compute.find_keypair(cls.NAME) is None: cls.conn.compute.create_keypair(name=cls.NAME) + image = cls.conn.image.find_image('fedora-20.x86_64') + if image is None: + image = cls.conn.image.find_image('cirros-0.3.4-x86_64-uec') + if image is None: + image = cls.conn.image.images().next() template_url = ('http://git.openstack.org/cgit/openstack/' + 'heat-templates/plain/hot/F20/WordPress_Native.yaml') sot = cls.conn.orchestration.create_stack( name=cls.NAME, - parameters={'key_name': cls.NAME, 'image_id': 'fedora-20.x86_64'}, + parameters={'key_name': cls.NAME, 'image_id': image.id}, template_url=template_url, ) assert isinstance(sot, stack.Stack) @@ -44,5 +49,5 @@ class TestStack(base.BaseFunctionalTest): cls.conn.compute.delete_keypair(cls.NAME) def test_list(self): - names = [o.name for o in self.conn.orchestration.list_stacks()] + names = [o.name for o in self.conn.orchestration.stacks()] self.assertIn(self.NAME, names) diff --git a/post_test_hook.sh b/post_test_hook.sh index 776dbb429..f68d10783 100755 --- a/post_test_hook.sh +++ b/post_test_hook.sh @@ -9,9 +9,11 @@ DIR=$(cd $(dirname "$0") && pwd) echo "Running SDK functional test suite" sudo -H -u stack -i <