Merge "Cap compute floating IPs tests"

This commit is contained in:
Zuul 2017-10-24 14:34:09 +00:00 committed by Gerrit Code Review
commit 0a2332cb36
5 changed files with 56 additions and 74 deletions

View File

@ -14,6 +14,10 @@
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest import config
CONF = config.CONF
class BaseFloatingIPsTest(base.BaseV2ComputeTest):
@ -24,3 +28,17 @@ class BaseFloatingIPsTest(base.BaseV2ComputeTest):
cls.set_network_resources(network=True, subnet=True,
router=True, dhcp=True)
super(BaseFloatingIPsTest, cls).setup_credentials()
@classmethod
def skip_checks(cls):
super(BaseFloatingIPsTest, cls).skip_checks()
if not utils.get_service_list()['network']:
raise cls.skipException("network service not enabled.")
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod
def setup_clients(cls):
super(BaseFloatingIPsTest, cls).setup_clients()
cls.client = cls.floating_ips_client
cls.pools_client = cls.floating_ip_pools_client

View File

@ -16,7 +16,6 @@
import testtools
from tempest.api.compute.floating_ips import base
from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
@ -27,32 +26,7 @@ CONF = config.CONF
class FloatingIPsTestJSON(base.BaseFloatingIPsTest):
@classmethod
def skip_checks(cls):
super(FloatingIPsTestJSON, cls).skip_checks()
if not utils.get_service_list()['network']:
raise cls.skipException("network service not enabled.")
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod
def setup_clients(cls):
super(FloatingIPsTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
@classmethod
def resource_setup(cls):
super(FloatingIPsTestJSON, cls).resource_setup()
# Server creation
server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
# Floating IP creation
body = cls.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
cls.addClassResourceCleanup(cls.client.delete_floating_ip, body['id'])
cls.floating_ip_id = body['id']
cls.floating_ip = body['ip']
max_microversion = '2.35'
@decorators.idempotent_id('f7bfb946-297e-41b8-9e8c-aba8e9bb5194')
def test_allocate_floating_ip(self):
@ -83,6 +57,25 @@ class FloatingIPsTestJSON(base.BaseFloatingIPsTest):
# Check it was really deleted.
self.client.wait_for_resource_deletion(floating_ip_body['id'])
class FloatingIPsAssociationTestJSON(base.BaseFloatingIPsTest):
max_microversion = '2.43'
@classmethod
def resource_setup(cls):
super(FloatingIPsAssociationTestJSON, cls).resource_setup()
# Server creation
cls.server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = cls.server['id']
# Floating IP creation
body = cls.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
cls.addClassResourceCleanup(cls.client.delete_floating_ip, body['id'])
cls.floating_ip_id = body['id']
cls.floating_ip = body['ip']
@decorators.idempotent_id('307efa27-dc6f-48a0-8cd2-162ce3ef0b52')
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')

View File

@ -16,7 +16,6 @@
import testtools
from tempest.api.compute.floating_ips import base
from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -27,26 +26,12 @@ CONF = config.CONF
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
@classmethod
def skip_checks(cls):
super(FloatingIPsNegativeTestJSON, cls).skip_checks()
if not utils.get_service_list()['network']:
raise cls.skipException("network service not enabled.")
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod
def setup_clients(cls):
super(FloatingIPsNegativeTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
max_microversion = '2.35'
@classmethod
def resource_setup(cls):
super(FloatingIPsNegativeTestJSON, cls).resource_setup()
# Server creation
server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
# Generating a nonexistent floatingIP id
body = cls.client.list_floating_ips()['floating_ips']
floating_ip_ids = [floating_ip['id'] for floating_ip in body]
@ -77,6 +62,17 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
self.assertRaises(lib_exc.NotFound, self.client.delete_floating_ip,
self.non_exist_id)
class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
max_microversion = '2.43'
@classmethod
def resource_setup(cls):
super(FloatingIPsAssociationNegativeTestJSON, cls).resource_setup()
cls.server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = cls.server['id']
@decorators.attr(type=['negative'])
@decorators.idempotent_id('595fa616-1a71-4670-9614-46564ac49a4c')
def test_associate_nonexistent_floating_ip(self):

View File

@ -13,29 +13,16 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.api.compute.floating_ips import base
from tempest import config
from tempest.lib import decorators
CONF = config.CONF
class FloatingIPDetailsTestJSON(base.BaseV2ComputeTest):
class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
@classmethod
def skip_checks(cls):
super(FloatingIPDetailsTestJSON, cls).skip_checks()
if not utils.get_service_list()['network']:
raise cls.skipException("network service not enabled.")
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod
def setup_clients(cls):
super(FloatingIPDetailsTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
cls.pools_client = cls.floating_ip_pools_client
max_microversion = '2.35'
@classmethod
def resource_setup(cls):

View File

@ -13,8 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.api.compute import base
from tempest.common import utils
from tempest.api.compute.floating_ips import base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
@ -23,20 +22,9 @@ from tempest.lib import exceptions as lib_exc
CONF = config.CONF
class FloatingIPDetailsNegativeTestJSON(base.BaseV2ComputeTest):
class FloatingIPDetailsNegativeTestJSON(base.BaseFloatingIPsTest):
@classmethod
def skip_checks(cls):
super(FloatingIPDetailsNegativeTestJSON, cls).skip_checks()
if not utils.get_service_list()['network']:
raise cls.skipException("network service not enabled.")
if not CONF.network_feature_enabled.floating_ips:
raise cls.skipException("Floating ips are not available")
@classmethod
def setup_clients(cls):
super(FloatingIPDetailsNegativeTestJSON, cls).setup_clients()
cls.client = cls.floating_ips_client
max_microversion = '2.35'
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7ab18834-4a4b-4f28-a2c5-440579866695')