diff options
author | Matt Riedemann <mriedem@us.ibm.com> | 2017-01-09 22:09:22 -0500 |
---|---|---|
committer | Matt Riedemann <mriedem@us.ibm.com> | 2017-01-24 18:44:37 -0500 |
commit | ae699768023bb0a8d60798eca7f0cc8aebfe3355 (patch) | |
tree | f488dac48f461af5cf7c18f475a7ecc36bfcef96 /novaclient/tests/functional/base.py | |
parent | 16b5bd09e93bc2dc0b6e4955e8508c0299efd2e0 (diff) | |
download | python-novaclient-ae699768023bb0a8d60798eca7f0cc8aebfe3355.tar.gz |
Fix functional tests to deal with multiple networks
There was a change in the openstacksdk 0.9.11 which
python-openstackclient uses to create networks in a devstack
run with Neutron. Because of this change, the admin tenant
has access to both the 'public' and 'private' network setup
in devstack which before used to just be the 'public' network,
which exposed a bug in the novaclient functional testing where
the admin user is attempting to create a server but not
specify a specific network to use, but multiple networks
are available to the admin (it can list multiple networks).
In this case the networks are the standard public and private
networks that are created in devstack. Since a network isn't
specified when creating the server, the nova API fails with a
409 error because it can't determine which network to use.
This patch fixes the testing in novaclient by checking to see
if there are multiple networks available and if so, specifies
one for the legacy BDM tests that weren't specifying a network
ID (those tests don't really care about the networking).
The auto-network test is skipped if there are multiple networks
available because passing in a specific network would defeat
the purpose of that test.
Change-Id: I22ee148581a94b153cf7e733563cfafaa56b1ffd
Closes-Bug: #1654806
Diffstat (limited to 'novaclient/tests/functional/base.py')
-rw-r--r-- | novaclient/tests/functional/base.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py index acc11013..f87298d4 100644 --- a/novaclient/tests/functional/base.py +++ b/novaclient/tests/functional/base.py @@ -230,10 +230,17 @@ class ClientTestBase(testtools.TestCase): self.client.api_version = proxy_api_version try: # TODO(mriedem): Get the networks from neutron if using neutron - CACHE["network"] = pick_network(self.client.networks.list()) + networks = self.client.networks.list() + # Keep track of whether or not there are multiple networks + # available to the given tenant because if so, a specific + # network ID has to be passed in on server create requests + # otherwise the server POST will fail with a 409. + CACHE['multiple_networks'] = len(networks) > 1 + CACHE["network"] = pick_network(networks) finally: self.client.api_version = tested_api_version self.network = CACHE["network"] + self.multiple_networks = CACHE['multiple_networks'] # create a CLI client in case we'd like to do CLI # testing. tempest.lib does this really weird thing where it |