Run examples tests with functional tests

The examples tests are currently not being run, which means they're
probably broken. Move them into the functional test dir so that they get
picked up when we run functional tests.

Change-Id: Id4dc9d48544134f304c2d2a0a292c04184316d70
This commit is contained in:
Monty Taylor 2018-02-02 07:13:11 -06:00
parent 5f86308082
commit 16e045db32
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
6 changed files with 15 additions and 19 deletions

View File

@ -20,17 +20,19 @@ import argparse
import os
import openstack
from openstack import config as occ
from openstack.config import loader
from openstack import utils
import sys
utils.enable_logging(True, stream=sys.stdout)
#: Defines the OpenStack Client Config (OCC) cloud key in your OCC config
#: file, typically in $HOME/.config/openstack/clouds.yaml. That configuration
#: Defines the OpenStack Config loud key in your config file,
#: typically in $HOME/.config/openstack/clouds.yaml. That configuration
#: will determine where the examples will be run and what resource defaults
#: will be used to run the examples.
TEST_CLOUD = os.getenv('OS_TEST_CLOUD', 'devstack-admin')
config = loader.OpenStackConfig()
cloud = openstack.connect(cloud=TEST_CLOUD)
class Opts(object):
@ -42,13 +44,7 @@ class Opts(object):
def _get_resource_value(resource_key, default):
try:
return cloud.config['example'][resource_key]
except KeyError:
return default
config = occ.OpenStackConfig()
cloud = openstack.connect(cloud=TEST_CLOUD)
return config.get_extra_config('example').get(resource_key, default)
SERVER_NAME = 'openstacksdk-example'
IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk')
@ -70,7 +66,7 @@ def create_connection_from_config():
def create_connection_from_args():
parser = argparse.ArgumentParser()
config = occ.OpenStackConfig()
config = loader.OpenStackConfig()
config.register_argparse_arguments(parser, sys.argv[1:])
args = parser.parse_args()
return openstack.connect(config=config.get_one(argparse=args))

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.tests.unit import base
from openstack.tests.functional import base
from examples.compute import create
from examples.compute import delete
@ -21,7 +21,7 @@ from examples.network import find as network_find
from examples.network import list as network_list
class TestCompute(base.TestCase):
class TestCompute(base.BaseFunctionalTest):
"""Test the compute examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.tests.unit import base
from openstack.tests.functional import base
from examples import connect
from examples.identity import list as identity_list
class TestIdentity(base.TestCase):
class TestIdentity(base.BaseFunctionalTest):
"""Test the identity examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.tests.unit import base
from openstack.tests.functional import base
from examples import connect
from examples.image import create as image_create
@ -18,7 +18,7 @@ from examples.image import delete as image_delete
from examples.image import list as image_list
class TestImage(base.TestCase):
class TestImage(base.BaseFunctionalTest):
"""Test the image examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.tests.unit import base
from openstack.tests.functional import base
from examples import connect
from examples.network import create as network_create
@ -19,7 +19,7 @@ from examples.network import find as network_find
from examples.network import list as network_list
class TestNetwork(base.TestCase):
class TestNetwork(base.BaseFunctionalTest):
"""Test the network examples
The purpose of these tests is to ensure the examples run without erring