diff --git a/doc/source/contributor/clouds.yaml b/doc/source/contributor/clouds.yaml index 04cd4aaf3..b92ba85b7 100644 --- a/doc/source/contributor/clouds.yaml +++ b/doc/source/contributor/clouds.yaml @@ -6,10 +6,6 @@ clouds: username: demo password: secrete project_name: demo - example: - image_name: fedora-20.x86_64 - flavor_name: m1.small - network_name: private rackspace: cloud: rackspace auth: @@ -17,3 +13,7 @@ clouds: password: joes-password project_name: 123123 region_name: IAD +example: + image_name: fedora-20.x86_64 + flavor_name: m1.small + network_name: private diff --git a/examples/connect.py b/examples/connect.py index 4a4eaa92f..1d4b86ad8 100644 --- a/examples/connect.py +++ b/examples/connect.py @@ -31,6 +31,7 @@ openstack.enable_logging(True, stream=sys.stdout) #: 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') +EXAMPLE_CONFIG_KEY = os.getenv('OPENSTACKSDK_EXAMPLE_CONFIG_KEY', 'example') config = loader.OpenStackConfig() cloud = openstack.connect(cloud=TEST_CLOUD) @@ -44,7 +45,8 @@ class Opts(object): def _get_resource_value(resource_key, default): - return config.get_extra_config('example').get(resource_key, default) + return config.get_extra_config( + EXAMPLE_CONFIG_KEY).get(resource_key, default) SERVER_NAME = 'openstacksdk-example' diff --git a/openstack/tests/functional/base.py b/openstack/tests/functional/base.py index 2c2a154a6..1a19153ba 100644 --- a/openstack/tests/functional/base.py +++ b/openstack/tests/functional/base.py @@ -22,15 +22,14 @@ from openstack.tests import base #: file, typically in $HOME/.config/openstack/clouds.yaml. That configuration #: will determine where the functional tests will be run and what resource #: defaults will be used to run the functional tests. +TEST_CONFIG = openstack.config.OpenStackConfig() TEST_CLOUD_NAME = os.getenv('OS_CLOUD', 'devstack-admin') TEST_CLOUD_REGION = openstack.config.get_cloud_region(cloud=TEST_CLOUD_NAME) def _get_resource_value(resource_key, default): - try: - return TEST_CLOUD_REGION.config['functional'][resource_key] - except KeyError: - return default + return TEST_CONFIG.get_extra_config( + 'functional').get(resource_key, default) def _disable_keep_alive(conn): diff --git a/openstack/tests/functional/cloud/test_clustering.py b/openstack/tests/functional/cloud/test_clustering.py index 9c3f775c2..75645b6da 100644 --- a/openstack/tests/functional/cloud/test_clustering.py +++ b/openstack/tests/functional/cloud/test_clustering.py @@ -116,7 +116,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -146,7 +146,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -190,7 +190,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -233,7 +233,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -319,7 +319,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -393,7 +393,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -475,7 +475,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -568,7 +568,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -657,7 +657,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -714,7 +714,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -776,7 +776,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -864,7 +864,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -915,7 +915,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1019,7 +1019,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1057,7 +1057,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1095,7 +1095,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1131,7 +1131,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1298,7 +1298,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" @@ -1357,7 +1357,7 @@ class TestClustering(base.BaseFunctionalTest): spec = { "properties": { "flavor": "m1.tiny", - "image": "cirros-0.4.0-x86_64-disk", + "image": base.IMAGE_NAME, "networks": [ { "network": "private" diff --git a/tox.ini b/tox.ini index db99c9573..43283d415 100644 --- a/tox.ini +++ b/tox.ini @@ -35,6 +35,7 @@ setenv = {[testenv]setenv} OS_TEST_TIMEOUT=600 OPENSTACKSDK_FUNC_TEST_TIMEOUT_LOAD_BALANCER=600 + OPENSTACKSDK_EXAMPLE_CONFIG_KEY=functional commands = stestr --test-path ./openstack/tests/functional/{env:OPENSTACKSDK_TESTS_SUBDIR:} run --serial {posargs} stestr slowest