Prepare for enabling H302 rule (scenario)

We can use H302 rule but ignore it now. This commit prepares for
enabling H302 rule. But this commit modifies tempest/scenario only
and excludes some violations[1] because if we fix all of them at one
time, it's hard to merge this commit.

[1]
 tempest.test.attr
 tempest.common.rest_client.RestClient
 tempest.common.rest_client.RestClientXML
 tempest.services.compute.xml.common.xml_to_json
 tempest.services.compute.xml.common.Element
 tempest.services.compute.xml.common.Document
 tempest.services.compute.xml.common.Text
 tempest.services.compute.xml.common.XMLNS_11
 tempest.services.compute.xml.common.XMLNS_V3
 tempest/clients.py

Change-Id: I57c26ef681120a9ee826b9cef26d1aaa734d69e5
This commit is contained in:
Masayuki Igawa 2014-02-17 15:05:59 +09:00
parent 405537895f
commit 4ded9f057d
12 changed files with 41 additions and 45 deletions

View File

@ -26,7 +26,7 @@ from tempest.api.network import common as net_common
from tempest import clients
from tempest.common import isolated_creds
from tempest.common.utils import data_utils
from tempest.common.utils.linux.remote_client import RemoteClient
from tempest.common.utils.linux import remote_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log
@ -358,7 +358,7 @@ class OfficialClientTest(tempest.test.BaseTestCase):
username = CONF.scenario.ssh_user
if private_key is None:
private_key = self.keypair.private_key
return RemoteClient(ip, username, pkey=private_key)
return remote_client.RemoteClient(ip, username, pkey=private_key)
def _log_console_output(self, servers=None):
if not servers:

View File

@ -15,10 +15,7 @@ import time
from tempest import config
from tempest.scenario import manager
from tempest.test import attr
from tempest.test import call_until_true
from tempest.test import services
from tempest.test import skip_because
from tempest import test
CONF = config.CONF
@ -64,9 +61,9 @@ class AutoScalingTest(manager.OrchestrationScenarioTest):
if not CONF.orchestration.keypair_name:
self.set_resource('stack', self.stack)
@skip_because(bug="1257575")
@attr(type='slow')
@services('orchestration', 'compute')
@test.skip_because(bug="1257575")
@test.attr(type='slow')
@test.services('orchestration', 'compute')
def test_scale_up_then_down(self):
self.assign_keypair()
@ -98,7 +95,7 @@ class AutoScalingTest(manager.OrchestrationScenarioTest):
return self.server_count
def assertScale(from_servers, to_servers):
call_until_true(lambda: server_count() == to_servers,
test.call_until_true(lambda: server_count() == to_servers,
timeout, interval)
self.assertEqual(to_servers, self.server_count,
'Failed scaling from %d to %d servers. '

View File

@ -14,7 +14,7 @@
# under the License.
from tempest.common import tempest_fixtures as fixtures
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest import test
@ -107,7 +107,7 @@ class TestAggregatesBasicOps(manager.OfficialClientTest):
def test_aggregate_basic_ops(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
az = 'foo_zone'
aggregate_name = rand_name('aggregate-scenario')
aggregate_name = data_utils.rand_name('aggregate-scenario')
aggregate = self._create_aggregate(name=aggregate_name,
availability_zone=az)
@ -119,7 +119,7 @@ class TestAggregatesBasicOps(manager.OfficialClientTest):
self._check_aggregate_details(aggregate, aggregate_name, az, [host],
metadata)
aggregate_name = rand_name('renamed-aggregate-scenario')
aggregate_name = data_utils.rand_name('renamed-aggregate-scenario')
aggregate = self._update_aggregate(aggregate, aggregate_name, None)
additional_metadata = {'foo': 'bar'}

View File

@ -19,7 +19,7 @@ from lxml import html
from tempest import config
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -69,7 +69,7 @@ class TestDashboardBasicOps(manager.OfficialClientTest):
response = self.opener.open(CONF.dashboard.dashboard_url)
self.assertIn('Overview', response.read())
@services('dashboard')
@test.services('dashboard')
def test_basic_scenario(self):
self.check_login_page()
self.user_login()

View File

@ -17,7 +17,7 @@ from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -63,7 +63,7 @@ class TestLargeOpsScenario(manager.NetworkScenarioTest):
self.set_resource(server.name, server)
self._wait_for_server_status('ACTIVE')
@services('compute', 'image')
@test.services('compute', 'image')
def test_large_ops_scenario(self):
if CONF.scenario.large_ops_number < 1:
return

View File

@ -17,7 +17,7 @@ from tempest.common import debug
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -112,7 +112,7 @@ class TestMinimumBasicScenario(manager.OfficialClientTest):
volume = self.volume_client.volumes.get(self.volume.id)
self.assertEqual('available', volume.status)
@services('compute', 'volume', 'image', 'network')
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
self.glance_image_create()
self.nova_keypair_add()

View File

@ -20,9 +20,7 @@ from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import attr
from tempest.test import call_until_true
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -355,7 +353,7 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
return not should_succeed
return should_succeed
return call_until_true(ping_remote,
return test.call_until_true(ping_remote,
CONF.compute.ping_timeout,
1)
@ -460,8 +458,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
subnet_id = tenant.subnet.id
self.assertIn((subnet_id, server_ip, mac_addr), port_detail_list)
@attr(type='smoke')
@services('compute', 'network')
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_cross_tenant_traffic(self):
try:
# deploy new tenant
@ -479,8 +477,8 @@ class TestSecurityGroupsBasicOps(manager.NetworkScenarioTest):
self._log_console_output(servers=tenant.servers)
raise
@attr(type='smoke')
@services('compute', 'network')
@test.attr(type='smoke')
@test.services('compute', 'network')
def test_in_tenant_traffic(self):
try:
self._create_tenant_servers(self.primary_tenant, num=1)

View File

@ -16,7 +16,7 @@
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -47,7 +47,7 @@ class TestServerAdvancedOps(manager.OfficialClientTest):
msg = "Skipping test - flavor_ref and flavor_ref_alt are identical"
raise cls.skipException(msg)
@services('compute')
@test.services('compute')
def test_resize_server_confirm(self):
# We create an instance for use in this test
instance = self.create_server()
@ -65,7 +65,7 @@ class TestServerAdvancedOps(manager.OfficialClientTest):
self.status_timeout(
self.compute_client.servers, instance_id, 'ACTIVE')
@services('compute')
@test.services('compute')
def test_server_sequence_suspend_resume(self):
# We create an instance for use in this test
instance = self.create_server()

View File

@ -18,7 +18,7 @@ from tempest.common.utils import test_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
import testscenarios
@ -162,7 +162,7 @@ class TestServerBasicOps(manager.OfficialClientTest):
self._log_console_output()
raise
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_basicops(self):
self.add_keypair()
self.create_security_group()

View File

@ -16,7 +16,7 @@
from tempest import config
from tempest.openstack.common import log
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -69,7 +69,7 @@ class TestSnapshotPattern(manager.OfficialClientTest):
def _set_floating_ip_to_server(self, server, floating_ip):
server.add_floating_ip(floating_ip)
@services('compute', 'network', 'image')
@test.services('compute', 'network', 'image')
def test_snapshot_pattern(self):
# prepare for booting a instance
self._add_keypair()

View File

@ -14,11 +14,11 @@
# under the License.
from tempest.common.utils.data_utils import rand_name
from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -53,7 +53,8 @@ class TestSwiftBasicOps(manager.OfficialClientTest):
LOG.debug('Swift status information obtained successfully')
def _create_container(self, container_name=None):
name = container_name or rand_name('swift-scenario-container')
name = container_name or data_utils.rand_name(
'swift-scenario-container')
self.object_storage_client.put_container(name)
# look for the container to assure it is created
self._list_and_check_container_objects(name)
@ -65,9 +66,9 @@ class TestSwiftBasicOps(manager.OfficialClientTest):
LOG.debug('Container %s deleted' % (container_name))
def _upload_object_to_container(self, container_name, obj_name=None):
obj_name = obj_name or rand_name('swift-scenario-object')
obj_name = obj_name or data_utils.rand_name('swift-scenario-object')
self.object_storage_client.put_object(container_name, obj_name,
rand_name('obj_data'),
data_utils.rand_name('obj_data'),
content_type='text/plain')
return obj_name
@ -93,7 +94,7 @@ class TestSwiftBasicOps(manager.OfficialClientTest):
for obj in not_present_obj:
self.assertNotIn(obj, object_list)
@services('object_storage')
@test.services('object_storage')
def test_swift_basic_ops(self):
self._get_swift_stat()
container_name = self._create_container()

View File

@ -14,7 +14,7 @@ from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
@ -127,7 +127,7 @@ class TestVolumeBootPattern(manager.OfficialClientTest):
actual = self._get_content(ssh_client)
self.assertEqual(expected, actual)
@services('compute', 'volume', 'image')
@test.services('compute', 'volume', 'image')
def test_volume_boot_pattern(self):
keypair = self.create_keypair()
self._create_loginable_secgroup_rule_nova()