Merge "Removes deprecated net_common module"
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 634bc01..6a5da58 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -70,6 +70,18 @@
self.assertEqual('204', resp['status'])
self.client.wait_for_server_termination(server['id'])
+ @testtools.skipUnless(CONF.compute_feature_enabled.suspend,
+ 'Suspend is not available.')
+ @test.attr(type='gate')
+ def test_delete_server_while_in_suspended_state(self):
+ # Delete a server while it's VM state is Suspended
+ _, server = self.create_test_server(wait_until='ACTIVE')
+ self.client.suspend_server(server['id'])
+ self.client.wait_for_server_status(server['id'], 'SUSPENDED')
+ resp, _ = self.client.delete_server(server['id'])
+ self.assertEqual('204', resp['status'])
+ self.client.wait_for_server_termination(server['id'])
+
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
'Shelve is not available.')
@test.attr(type='gate')
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 6032976..98fe387 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -233,6 +233,30 @@
self.assertNotIn(self.s3_name, map(lambda x: x['name'], servers))
@test.attr(type='gate')
+ def test_list_servers_filtered_by_name_regex(self):
+ # list of regex that should match s1, s2 and s3
+ regexes = ['^.*\-instance\-[0-9]+$', '^.*\-instance\-.*$']
+ for regex in regexes:
+ params = {'name': regex}
+ resp, body = self.client.list_servers(params)
+ servers = body['servers']
+
+ self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
+ self.assertIn(self.s2_name, map(lambda x: x['name'], servers))
+ self.assertIn(self.s3_name, map(lambda x: x['name'], servers))
+
+ # Let's take random part of name and try to search it
+ part_name = self.s1_name[-10:]
+
+ params = {'name': part_name}
+ resp, body = self.client.list_servers(params)
+ servers = body['servers']
+
+ self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
+ self.assertNotIn(self.s2_name, map(lambda x: x['name'], servers))
+ self.assertNotIn(self.s3_name, map(lambda x: x['name'], servers))
+
+ @test.attr(type='gate')
def test_list_servers_filtered_by_ip(self):
# Filter servers by ip
# Here should be listed 1 server
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 071bbfb..3aacf2a 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -75,9 +75,7 @@
new_password)
linux_client.validate_authentication()
- @test.attr(type='smoke')
- def test_reboot_server_hard(self):
- # The server should be power cycled
+ def _test_reboot_server(self, reboot_type):
if self.run_ssh:
# Get the time the server was last rebooted,
resp, server = self.client.get_server(self.server_id)
@@ -85,7 +83,7 @@
self.password)
boot_time = linux_client.get_boot_time()
- resp, body = self.client.reboot(self.server_id, 'HARD')
+ resp, body = self.client.reboot(self.server_id, reboot_type)
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
@@ -97,28 +95,16 @@
self.assertTrue(new_boot_time > boot_time,
'%s > %s' % (new_boot_time, boot_time))
+ @test.attr(type='smoke')
+ def test_reboot_server_hard(self):
+ # The server should be power cycled
+ self._test_reboot_server('HARD')
+
@test.skip_because(bug="1014647")
@test.attr(type='smoke')
def test_reboot_server_soft(self):
# The server should be signaled to reboot gracefully
- if self.run_ssh:
- # Get the time the server was last rebooted,
- resp, server = self.client.get_server(self.server_id)
- linux_client = remote_client.RemoteClient(server, self.ssh_user,
- self.password)
- boot_time = linux_client.get_boot_time()
-
- resp, body = self.client.reboot(self.server_id, 'SOFT')
- self.assertEqual(202, resp.status)
- self.client.wait_for_server_status(self.server_id, 'ACTIVE')
-
- if self.run_ssh:
- # Log in and verify the boot time has changed
- linux_client = remote_client.RemoteClient(server, self.ssh_user,
- self.password)
- new_boot_time = linux_client.get_boot_time()
- self.assertTrue(new_boot_time > boot_time,
- '%s > %s' % (new_boot_time, boot_time))
+ self._test_reboot_server('SOFT')
@test.attr(type='smoke')
def test_rebuild_server(self):
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index 0e062c5..58511a9 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -35,8 +35,8 @@
"""
@classmethod
- def setUpClass(cls):
- super(BaseMessagingTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseMessagingTest, cls).resource_setup()
if not CONF.service_available.zaqar:
raise cls.skipException("Zaqar support is required")
os = cls.get_client_manager()
diff --git a/tempest/api/messaging/test_claims.py b/tempest/api/messaging/test_claims.py
index 885f00e..1b004dd 100644
--- a/tempest/api/messaging/test_claims.py
+++ b/tempest/api/messaging/test_claims.py
@@ -30,8 +30,8 @@
_interface = 'json'
@classmethod
- def setUpClass(cls):
- super(TestClaims, cls).setUpClass()
+ def resource_setup(cls):
+ super(TestClaims, cls).resource_setup()
cls.queue_name = data_utils.rand_name('Queues-Test')
# Create Queue
cls.create_queue(cls.queue_name)
@@ -118,6 +118,6 @@
self.client.delete_messages(message_uri)
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
cls.delete_queue(cls.queue_name)
- super(TestClaims, cls).tearDownClass()
+ super(TestClaims, cls).resource_cleanup()
diff --git a/tempest/api/messaging/test_messages.py b/tempest/api/messaging/test_messages.py
index 3217361..3c27ac2 100644
--- a/tempest/api/messaging/test_messages.py
+++ b/tempest/api/messaging/test_messages.py
@@ -29,8 +29,8 @@
_interface = 'json'
@classmethod
- def setUpClass(cls):
- super(TestMessages, cls).setUpClass()
+ def resource_setup(cls):
+ super(TestMessages, cls).resource_setup()
cls.queue_name = data_utils.rand_name('Queues-Test')
# Create Queue
cls.client.create_queue(cls.queue_name)
@@ -117,6 +117,6 @@
self.assertEqual('204', resp['status'])
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
cls.delete_queue(cls.queue_name)
- super(TestMessages, cls).tearDownClass()
+ super(TestMessages, cls).resource_cleanup()
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index edfe10e..ab099ff 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -44,8 +44,8 @@
_interface = 'json'
@classmethod
- def setUpClass(cls):
- super(TestManageQueue, cls).setUpClass()
+ def resource_setup(cls):
+ super(TestManageQueue, cls).resource_setup()
cls.queues = list()
for _ in moves.xrange(5):
queue_name = data_utils.rand_name('Queues-Test')
@@ -125,7 +125,7 @@
self.assertThat(body, matchers.Equals(req_body))
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for queue_name in cls.queues:
cls.client.delete_queue(queue_name)
- super(TestManageQueue, cls).tearDownClass()
+ super(TestManageQueue, cls).resource_cleanup()
diff --git a/tempest/api/network/test_fwaas_extensions.py b/tempest/api/network/test_fwaas_extensions.py
index 193bf76..11588d6 100644
--- a/tempest/api/network/test_fwaas_extensions.py
+++ b/tempest/api/network/test_fwaas_extensions.py
@@ -86,7 +86,6 @@
(fw_id, target_states))
raise exceptions.TimeoutException(m)
- @test.attr(type='smoke')
def test_list_firewall_rules(self):
# List firewall rules
_, fw_rules = self.client.list_firewall_rules()
@@ -104,7 +103,6 @@
m['ip_version'],
m['enabled']) for m in fw_rules])
- @test.attr(type='smoke')
def test_create_update_delete_firewall_rule(self):
# Create firewall rule
_, body = self.client.create_firewall_rule(
@@ -125,14 +123,12 @@
self.assertNotIn(fw_rule_id,
[m['id'] for m in fw_rules['firewall_rules']])
- @test.attr(type='smoke')
def test_show_firewall_rule(self):
# show a created firewall rule
_, fw_rule = self.client.show_firewall_rule(self.fw_rule['id'])
for key, value in fw_rule['firewall_rule'].iteritems():
self.assertEqual(self.fw_rule[key], value)
- @test.attr(type='smoke')
def test_list_firewall_policies(self):
_, fw_policies = self.client.list_firewall_policies()
fw_policies = fw_policies['firewall_policies']
@@ -143,7 +139,6 @@
m['name'],
m['firewall_rules']) for m in fw_policies])
- @test.attr(type='smoke')
def test_create_update_delete_firewall_policy(self):
# Create firewall policy
_, body = self.client.create_firewall_policy(
@@ -166,7 +161,6 @@
fw_policies = fw_policies['firewall_policies']
self.assertNotIn(fw_policy_id, [m['id'] for m in fw_policies])
- @test.attr(type='smoke')
def test_show_firewall_policy(self):
# show a created firewall policy
_, fw_policy = self.client.show_firewall_policy(self.fw_policy['id'])
@@ -174,7 +168,6 @@
for key, value in fw_policy.iteritems():
self.assertEqual(self.fw_policy[key], value)
- @test.attr(type='smoke')
def test_create_show_delete_firewall(self):
# Create tenant network resources required for an ACTIVE firewall
network = self.create_network()
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index e1eb48d..986a2c8 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -17,6 +17,7 @@
import testtools
from tempest.api.network import base
+from tempest.common import custom_matchers
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
@@ -65,13 +66,94 @@
cls.name = cls.network['name']
cls.subnet = cls.create_subnet(cls.network)
cls.cidr = cls.subnet['cidr']
+ cls._subnet_data = {6: {'gateway':
+ str(cls._get_gateway_from_tempest_conf(6)),
+ 'allocation_pools':
+ cls._get_allocation_pools_from_gateway(6),
+ 'dns_nameservers': ['2001:4860:4860::8844',
+ '2001:4860:4860::8888'],
+ 'host_routes': [{'destination': '2001::/64',
+ 'nexthop': '2003::1'}],
+ 'new_host_routes': [{'destination':
+ '2001::/64',
+ 'nexthop': '2005::1'}],
+ 'new_dns_nameservers':
+ ['2001:4860:4860::7744',
+ '2001:4860:4860::7888']},
+ 4: {'gateway':
+ str(cls._get_gateway_from_tempest_conf(4)),
+ 'allocation_pools':
+ cls._get_allocation_pools_from_gateway(4),
+ 'dns_nameservers': ['8.8.4.4', '8.8.8.8'],
+ 'host_routes': [{'destination': '10.20.0.0/32',
+ 'nexthop': '10.100.1.1'}],
+ 'new_host_routes': [{'destination':
+ '10.20.0.0/32',
+ 'nexthop':
+ '10.100.1.2'}],
+ 'new_dns_nameservers': ['7.8.8.8', '7.8.4.4']}}
+
+ @classmethod
+ def _get_gateway_from_tempest_conf(cls, ip_version):
+ """Return first subnet gateway for configured CIDR """
+ if ip_version == 4:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
+ mask_bits = CONF.network.tenant_network_mask_bits
+ elif ip_version == 6:
+ cidr = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
+ mask_bits = CONF.network.tenant_network_v6_mask_bits
+
+ if mask_bits >= cidr.prefixlen:
+ return netaddr.IPAddress(cidr) + 1
+ else:
+ for subnet in cidr.subnet(mask_bits):
+ return netaddr.IPAddress(subnet) + 1
+
+ @classmethod
+ def _get_allocation_pools_from_gateway(cls, ip_version):
+ """Return allocation range for subnet of given gateway"""
+ gateway = cls._get_gateway_from_tempest_conf(ip_version)
+ return [{'start': str(gateway + 2), 'end': str(gateway + 3)}]
+
+ def subnet_dict(self, include_keys):
+ """Return a subnet dict which has include_keys and their corresponding
+ value from self._subnet_data
+ """
+ return dict((key, self._subnet_data[self._ip_version][key])
+ for key in include_keys)
+
+ def _compare_resource_attrs(self, actual, expected):
+ exclude_keys = set(actual).symmetric_difference(expected)
+ self.assertThat(actual, custom_matchers.MatchesDictExceptForKeys(
+ expected, exclude_keys))
+
+ def _create_verify_delete_subnet(self, cidr=None, mask_bits=None,
+ **kwargs):
+ network = self.create_network()
+ net_id = network['id']
+ gateway = kwargs.pop('gateway', None)
+ subnet = self.create_subnet(network, gateway, cidr, mask_bits,
+ **kwargs)
+ compare_args_full = dict(gateway_ip=gateway, cidr=cidr,
+ mask_bits=mask_bits, **kwargs)
+ compare_args = dict((k, v) for k, v in compare_args_full.iteritems()
+ if v is not None)
+
+ if 'dns_nameservers' in set(subnet).intersection(compare_args):
+ self.assertEqual(sorted(compare_args['dns_nameservers']),
+ sorted(subnet['dns_nameservers']))
+ del subnet['dns_nameservers'], compare_args['dns_nameservers']
+
+ self._compare_resource_attrs(subnet, compare_args)
+ self.client.delete_network(net_id)
+ self.networks.pop()
+ self.subnets.pop()
@test.attr(type='smoke')
def test_create_update_delete_network_subnet(self):
# Create a network
name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
+ network = self.create_network(network_name=name)
net_id = network['id']
self.assertEqual('ACTIVE', network['status'])
# Verify network update
@@ -87,11 +169,6 @@
_, body = self.client.update_subnet(subnet_id, name=new_name)
updated_subnet = body['subnet']
self.assertEqual(updated_subnet['name'], new_name)
- # Delete subnet and network
- _, body = self.client.delete_subnet(subnet_id)
- # Remove subnet from cleanup list
- self.subnets.pop()
- _, body = self.client.delete_network(net_id)
@test.attr(type='smoke')
def test_show_network(self):
@@ -204,32 +281,65 @@
@test.attr(type='smoke')
def test_create_delete_subnet_with_gw(self):
- gateway = '10.100.0.13'
- name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
- net_id = network['id']
- subnet = self.create_subnet(network, gateway)
- # Verifies Subnet GW in IPv4
- self.assertEqual(subnet['gateway_ip'], gateway)
- # Delete network and subnet
- self.client.delete_network(net_id)
- self.subnets.pop()
+ self._create_verify_delete_subnet(
+ **self.subnet_dict(['gateway']))
@test.attr(type='smoke')
- def test_create_delete_subnet_without_gw(self):
- net = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
- gateway_ip = str(netaddr.IPAddress(net.first + 1))
- name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
- net_id = network['id']
- subnet = self.create_subnet(network)
- # Verifies Subnet GW in IPv4
- self.assertEqual(subnet['gateway_ip'], gateway_ip)
- # Delete network and subnet
- self.client.delete_network(net_id)
- self.subnets.pop()
+ def test_create_delete_subnet_with_allocation_pools(self):
+ self._create_verify_delete_subnet(
+ **self.subnet_dict(['allocation_pools']))
+
+ @test.attr(type='smoke')
+ def test_create_delete_subnet_with_gw_and_allocation_pools(self):
+ self._create_verify_delete_subnet(**self.subnet_dict(
+ ['gateway', 'allocation_pools']))
+
+ @test.attr(type='smoke')
+ def test_create_delete_subnet_with_host_routes_and_dns_nameservers(self):
+ self._create_verify_delete_subnet(
+ **self.subnet_dict(['host_routes', 'dns_nameservers']))
+
+ @test.attr(type='smoke')
+ def test_create_delete_subnet_with_dhcp_enabled(self):
+ self._create_verify_delete_subnet(enable_dhcp=True)
+
+ @test.attr(type='smoke')
+ def test_update_subnet_gw_dns_host_routes_dhcp(self):
+ network = self.create_network()
+
+ subnet = self.create_subnet(
+ network, **self.subnet_dict(['gateway', 'host_routes',
+ 'dns_nameservers',
+ 'allocation_pools']))
+ subnet_id = subnet['id']
+ new_gateway = str(netaddr.IPAddress(
+ self._subnet_data[self._ip_version]['gateway']) + 1)
+ # Verify subnet update
+ new_host_routes = self._subnet_data[self._ip_version][
+ 'new_host_routes']
+
+ new_dns_nameservers = self._subnet_data[self._ip_version][
+ 'new_dns_nameservers']
+ kwargs = {'host_routes': new_host_routes,
+ 'dns_nameservers': new_dns_nameservers,
+ 'gateway_ip': new_gateway, 'enable_dhcp': True}
+
+ new_name = "New_subnet"
+ _, body = self.client.update_subnet(subnet_id, name=new_name,
+ **kwargs)
+ updated_subnet = body['subnet']
+ kwargs['name'] = new_name
+ self.assertEqual(sorted(updated_subnet['dns_nameservers']),
+ sorted(kwargs['dns_nameservers']))
+ del subnet['dns_nameservers'], kwargs['dns_nameservers']
+
+ self._compare_resource_attrs(updated_subnet, kwargs)
+
+ @test.attr(type='smoke')
+ def test_create_delete_subnet_all_attributes(self):
+ self._create_verify_delete_subnet(
+ enable_dhcp=True,
+ **self.subnet_dict(['gateway', 'host_routes', 'dns_nameservers']))
class NetworksTestXML(NetworksTestJSON):
@@ -376,51 +486,30 @@
net = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
gateway = str(netaddr.IPAddress(net.first + 2))
name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
- net_id = network['id']
+ network = self.create_network(network_name=name)
subnet = self.create_subnet(network, gateway)
# Verifies Subnet GW in IPv6
self.assertEqual(subnet['gateway_ip'], gateway)
- # Delete network and subnet
- self.client.delete_network(net_id)
- self.subnets.pop()
@test.attr(type='smoke')
def test_create_delete_subnet_without_gw(self):
net = netaddr.IPNetwork(CONF.network.tenant_network_v6_cidr)
gateway_ip = str(netaddr.IPAddress(net.first + 1))
name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
- net_id = network['id']
+ network = self.create_network(network_name=name)
subnet = self.create_subnet(network)
# Verifies Subnet GW in IPv6
self.assertEqual(subnet['gateway_ip'], gateway_ip)
- # Delete network and subnet
- _, body = self.client.delete_network(net_id)
- self.subnets.pop()
@testtools.skipUnless(CONF.network_feature_enabled.ipv6_subnet_attributes,
"IPv6 extended attributes for subnets not "
"available")
@test.attr(type='smoke')
def test_create_delete_subnet_with_v6_attributes(self):
- name = data_utils.rand_name('network-')
- _, body = self.client.create_network(name=name)
- network = body['network']
- net_id = network['id']
- subnet = self.create_subnet(network,
- gateway='fe80::1',
- ipv6_ra_mode='slaac',
- ipv6_address_mode='slaac')
- # Verifies Subnet GW in IPv6
- self.assertEqual(subnet['gateway_ip'], 'fe80::1')
- self.assertEqual(subnet['ipv6_ra_mode'], 'slaac')
- self.assertEqual(subnet['ipv6_address_mode'], 'slaac')
- # Delete network and subnet
- self.client.delete_network(net_id)
- self.subnets.pop()
+ self._create_verify_delete_subnet(
+ gateway=self._subnet_data[self._ip_version]['gateway'],
+ ipv6_ra_mode='slaac',
+ ipv6_address_mode='slaac')
class NetworksIpV6TestXML(NetworksIpV6TestJSON):
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 0b22de5..5a586fc 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -30,8 +30,8 @@
"""Base test case class for all Orchestration API tests."""
@classmethod
- def setUpClass(cls):
- super(BaseOrchestrationTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseOrchestrationTest, cls).resource_setup()
cls.os = clients.Manager()
if not CONF.service_available.heat:
raise cls.skipException("Heat support is required")
@@ -146,11 +146,11 @@
return yaml.safe_load(f)
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
cls._clear_stacks()
cls._clear_keypairs()
cls._clear_images()
- super(BaseOrchestrationTest, cls).tearDownClass()
+ super(BaseOrchestrationTest, cls).resource_cleanup()
@staticmethod
def stack_output(stack, output_key):
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index ffadb16..f1a4f85 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -30,9 +30,8 @@
class NeutronResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
- @test.safe_setup
- def setUpClass(cls):
- super(NeutronResourcesTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(NeutronResourcesTestJSON, cls).resource_setup()
if not CONF.orchestration.image_ref:
raise cls.skipException("No image available to test")
os = clients.Manager()
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 72ad5f5..759cbbe 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -25,8 +25,8 @@
class StacksTestJSON(base.BaseOrchestrationTest):
@classmethod
- def setUpClass(cls):
- super(StacksTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(StacksTestJSON, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('non_empty_stack')
image_id = (CONF.orchestration.image_ref or
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 2f58611..1da340c 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -27,8 +27,8 @@
_type = 'type'
@classmethod
- def setUpClass(cls):
- super(NovaKeyPairResourcesYAMLTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(NovaKeyPairResourcesYAMLTest, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('nova_keypair', ext=cls._tpl_type)
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index 8023f2c..d7fbd65 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -23,8 +23,8 @@
empty_template = "HeatTemplateFormatVersion: '2012-12-12'\n"
@classmethod
- def setUpClass(cls):
- super(StacksTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(StacksTestJSON, cls).resource_setup()
@test.attr(type='smoke')
def test_stack_list_responds(self):
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index d7c2a0d..307468e 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -26,9 +26,8 @@
class SwiftResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
- @test.safe_setup
- def setUpClass(cls):
- super(SwiftResourcesTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(SwiftResourcesTestJSON, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
template = cls.read_template('swift_basic')
os = clients.Manager()
diff --git a/tempest/api/orchestration/stacks/test_templates.py b/tempest/api/orchestration/stacks/test_templates.py
index 0d6060d..262c576 100644
--- a/tempest/api/orchestration/stacks/test_templates.py
+++ b/tempest/api/orchestration/stacks/test_templates.py
@@ -26,9 +26,8 @@
"""
@classmethod
- @test.safe_setup
- def setUpClass(cls):
- super(TemplateYAMLTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(TemplateYAMLTestJSON, cls).resource_setup()
cls.stack_name = data_utils.rand_name('heat')
cls.stack_identifier = cls.create_stack(cls.stack_name, cls.template)
cls.client.wait_for_stack_status(cls.stack_identifier,
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index b325104..9082107 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_negative.py
@@ -30,8 +30,8 @@
invalid_template_url = 'http://www.example.com/template.yaml'
@classmethod
- def setUpClass(cls):
- super(TemplateYAMLNegativeTestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(TemplateYAMLNegativeTestJSON, cls).resource_setup()
cls.parameters = {}
@test.attr(type=['gate', 'negative'])
diff --git a/tempest/api/orchestration/stacks/test_volumes.py b/tempest/api/orchestration/stacks/test_volumes.py
index f371370..f47078c 100644
--- a/tempest/api/orchestration/stacks/test_volumes.py
+++ b/tempest/api/orchestration/stacks/test_volumes.py
@@ -26,8 +26,8 @@
class CinderResourcesTest(base.BaseOrchestrationTest):
@classmethod
- def setUpClass(cls):
- super(CinderResourcesTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(CinderResourcesTest, cls).resource_setup()
if not CONF.service_available.cinder:
raise cls.skipException('Cinder support is required')
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 8c2f37b..769c201 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -26,11 +26,11 @@
"""Base test case class for all Telemetry API tests."""
@classmethod
- def setUpClass(cls):
+ def resource_setup(cls):
if not CONF.service_available.ceilometer:
raise cls.skipException("Ceilometer support is required")
cls.set_network_resources()
- super(BaseTelemetryTest, cls).setUpClass()
+ super(BaseTelemetryTest, cls).resource_setup()
os = cls.get_client_manager()
cls.telemetry_client = os.telemetry_client
cls.servers_client = os.servers_client
@@ -84,12 +84,12 @@
pass
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
cls.cleanup_resources(cls.telemetry_client.delete_alarm, cls.alarm_ids)
cls.cleanup_resources(cls.servers_client.delete_server, cls.server_ids)
cls.cleanup_resources(cls.image_client.delete_image, cls.image_ids)
cls.clear_isolated_creds()
- super(BaseTelemetryTest, cls).tearDownClass()
+ super(BaseTelemetryTest, cls).resource_cleanup()
def await_samples(self, metric, query):
"""
diff --git a/tempest/api/telemetry/test_telemetry_alarming_api.py b/tempest/api/telemetry/test_telemetry_alarming_api.py
index 95758e8..b45d545 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_telemetry_alarming_api.py
@@ -20,8 +20,8 @@
_interface = 'json'
@classmethod
- def setUpClass(cls):
- super(TelemetryAlarmingAPITestJSON, cls).setUpClass()
+ def resource_setup(cls):
+ super(TelemetryAlarmingAPITestJSON, cls).resource_setup()
cls.rule = {'meter_name': 'cpu_util',
'comparison_operator': 'gt',
'threshold': 80.0,
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 9b15c51..3782b70 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -23,11 +23,11 @@
_interface = 'json'
@classmethod
- def setUpClass(cls):
+ def resource_setup(cls):
if CONF.telemetry.too_slow_to_test:
raise cls.skipException("Ceilometer feature for fast work mysql "
"is disabled")
- super(TelemetryNotificationAPITestJSON, cls).setUpClass()
+ super(TelemetryNotificationAPITestJSON, cls).resource_setup()
@test.attr(type="gate")
@testtools.skipIf(not CONF.service_available.nova,
diff --git a/tempest/cli/simple_read_only/compute/test_nova_manage.py b/tempest/cli/simple_read_only/compute/test_nova_manage.py
index c27b12e..a4c7aa1 100644
--- a/tempest/cli/simple_read_only/compute/test_nova_manage.py
+++ b/tempest/cli/simple_read_only/compute/test_nova_manage.py
@@ -65,20 +65,17 @@
self.nova_manage('', '--version', merge_stderr=True))
def test_debug_flag(self):
- self.assertNotEqual("", self.nova_manage('flavor list',
+ self.assertNotEqual("", self.nova_manage('service list',
'--debug'))
def test_verbose_flag(self):
- self.assertNotEqual("", self.nova_manage('flavor list',
+ self.assertNotEqual("", self.nova_manage('service list',
'--verbose'))
# test actions
def test_version(self):
self.assertNotEqual("", self.nova_manage('version'))
- def test_flavor_list(self):
- self.assertNotEqual("", self.nova_manage('flavor list'))
-
def test_db_sync(self):
# make sure command doesn't error out
self.nova_manage('db sync')
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 27e388d..3c41dd9 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -184,7 +184,9 @@
def destroy_users(users):
admin = keystone_admin()
for user in users:
- user_id = admin.identity.get_user_by_name(user['name'])['id']
+ tenant_id = admin.identity.get_tenant_by_name(user['tenant'])['id']
+ user_id = admin.identity.get_user_by_username(tenant_id,
+ user['name'])['id']
r, body = admin.identity.delete_user(user_id)
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index c764b39..0277593 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -92,6 +92,7 @@
self.servers_client.wait_for_server_status(self.server['id'], 'ACTIVE')
self._check_network_connectivity()
+ @test.skip_because(bug="1323658")
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
self._setup_network_and_servers()
@@ -139,6 +140,7 @@
self.servers_client.resume_server(self.server['id'])
self._wait_server_status_and_check_network_connectivity()
+ @test.skip_because(bug="1323658")
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize is not available.')
@test.services('compute', 'network')
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index ee904c7..c0d3f7a 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -200,29 +200,6 @@
instance.terminate()
self.assertInstanceStateWait(instance, '_GONE')
- def test_run_reboot_terminate_instance(self):
- # EC2 run, await till it reaches to running state, then reboot,
- # and wait untill its state is running, and then terminate
- image_ami = self.ec2_client.get_image(self.images["ami"]
- ["image_id"])
- reservation = image_ami.run(kernel_id=self.images["aki"]["image_id"],
- ramdisk_id=self.images["ari"]["image_id"],
- instance_type=self.instance_type)
-
- self.assertEqual(1, len(reservation.instances))
-
- instance = reservation.instances[0]
- if instance.state != "running":
- self.assertInstanceStateWait(instance, "running")
-
- instance.reboot()
- if instance.state != "running":
- self.assertInstanceStateWait(instance, "running")
- LOG.debug("Instance rebooted - state: %s", instance.state)
-
- instance.terminate()
- self.assertInstanceStateWait(instance, '_GONE')
-
def test_compute_with_volumes(self):
# EC2 1. integration test (not strict)
image_ami = self.ec2_client.get_image(self.images["ami"]["image_id"])