Merge "Migrate test_snapshot_pattern to tempest client"
diff --git a/etc/schemas/compute/admin/flavor_create.json b/etc/schemas/compute/admin/flavor_create.json
deleted file mode 100644
index 0a3e7b3..0000000
--- a/etc/schemas/compute/admin/flavor_create.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "flavor-create",
- "http-method": "POST",
- "admin_client": true,
- "url": "flavors",
- "default_result_code": 400,
- "json-schema": {
- "type": "object",
- "properties": {
- "name": { "type": "string"},
- "ram": { "type": "integer", "minimum": 1},
- "vcpus": { "type": "integer", "minimum": 1},
- "disk": { "type": "integer"},
- "id": { "type": "integer"},
- "swap": { "type": "integer"},
- "rxtx_factor": { "type": "integer"},
- "OS-FLV-EXT-DATA:ephemeral": { "type": "integer"}
- }
- }
-}
diff --git a/etc/schemas/compute/servers/get_console_output.json b/etc/schemas/compute/servers/get_console_output.json
deleted file mode 100644
index 8d974ba..0000000
--- a/etc/schemas/compute/servers/get_console_output.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "get-console-output",
- "http-method": "POST",
- "url": "servers/%s/action",
- "resources": [
- {"name":"server", "expected_result": 404}
- ],
- "json-schema": {
- "type": "object",
- "properties": {
- "os-getConsoleOutput": {
- "type": "object",
- "properties": {
- "length": {
- "type": ["integer", "string"],
- "minimum": 0
- }
- }
- }
- },
- "additionalProperties": false
- }
-}
diff --git a/tempest/api/baremetal/admin/test_api_discovery.py b/tempest/api/baremetal/admin/test_api_discovery.py
index 7368b3e..09788f2 100644
--- a/tempest/api/baremetal/admin/test_api_discovery.py
+++ b/tempest/api/baremetal/admin/test_api_discovery.py
@@ -19,10 +19,8 @@
@test.attr(type='smoke')
def test_api_versions(self):
- resp, descr = self.client.get_api_description()
- self.assertEqual('200', resp['status'])
+ _, descr = self.client.get_api_description()
expected_versions = ('v1',)
-
versions = [version['id'] for version in descr['versions']]
for v in expected_versions:
@@ -30,16 +28,13 @@
@test.attr(type='smoke')
def test_default_version(self):
- resp, descr = self.client.get_api_description()
- self.assertEqual('200', resp['status'])
+ _, descr = self.client.get_api_description()
default_version = descr['default_version']
-
self.assertEqual(default_version['id'], 'v1')
@test.attr(type='smoke')
def test_version_1_resources(self):
- resp, descr = self.client.get_version_description(version='v1')
- self.assertEqual('200', resp['status'])
+ _, descr = self.client.get_version_description(version='v1')
expected_resources = ('nodes', 'chassis',
'ports', 'links', 'media_types')
diff --git a/tempest/api/baremetal/admin/test_chassis.py b/tempest/api/baremetal/admin/test_chassis.py
index c306c34..254a969 100644
--- a/tempest/api/baremetal/admin/test_chassis.py
+++ b/tempest/api/baremetal/admin/test_chassis.py
@@ -35,8 +35,7 @@
@test.attr(type='smoke')
def test_create_chassis(self):
descr = data_utils.rand_name('test-chassis-')
- resp, chassis = self.create_chassis(description=descr)
- self.assertEqual('201', resp['status'])
+ _, chassis = self.create_chassis(description=descr)
self.assertEqual(chassis['description'], descr)
@test.attr(type='smoke')
@@ -44,40 +43,35 @@
# Use a unicode string for testing:
# 'We ♡ OpenStack in Ukraine'
descr = u'В Україні ♡ OpenStack!'
- resp, chassis = self.create_chassis(description=descr)
- self.assertEqual('201', resp['status'])
+ _, chassis = self.create_chassis(description=descr)
self.assertEqual(chassis['description'], descr)
@test.attr(type='smoke')
def test_show_chassis(self):
- resp, chassis = self.client.show_chassis(self.chassis['uuid'])
- self.assertEqual('200', resp['status'])
+ _, chassis = self.client.show_chassis(self.chassis['uuid'])
self._assertExpected(self.chassis, chassis)
@test.attr(type="smoke")
def test_list_chassis(self):
- resp, body = self.client.list_chassis()
- self.assertEqual('200', resp['status'])
+ _, body = self.client.list_chassis()
self.assertIn(self.chassis['uuid'],
[i['uuid'] for i in body['chassis']])
@test.attr(type='smoke')
def test_delete_chassis(self):
- resp, body = self.create_chassis()
+ _, body = self.create_chassis()
uuid = body['uuid']
- resp = self.delete_chassis(uuid)
- self.assertEqual('204', resp['status'])
+ self.delete_chassis(uuid)
self.assertRaises(exc.NotFound, self.client.show_chassis, uuid)
@test.attr(type='smoke')
def test_update_chassis(self):
- resp, body = self.create_chassis()
+ _, body = self.create_chassis()
uuid = body['uuid']
new_description = data_utils.rand_name('new-description-')
- resp, body = (self.client.update_chassis(uuid,
- description=new_description))
- self.assertEqual('200', resp['status'])
- resp, chassis = self.client.show_chassis(uuid)
+ _, body = (self.client.update_chassis(uuid,
+ description=new_description))
+ _, chassis = self.client.show_chassis(uuid)
self.assertEqual(chassis['description'], new_description)
diff --git a/tempest/api/baremetal/admin/test_drivers.py b/tempest/api/baremetal/admin/test_drivers.py
index 649886b..9e215dc 100644
--- a/tempest/api/baremetal/admin/test_drivers.py
+++ b/tempest/api/baremetal/admin/test_drivers.py
@@ -29,13 +29,11 @@
@test.attr(type="smoke")
def test_list_drivers(self):
- resp, drivers = self.client.list_drivers()
- self.assertEqual('200', resp['status'])
+ _, drivers = self.client.list_drivers()
self.assertIn(self.driver_name,
[d['name'] for d in drivers['drivers']])
@test.attr(type="smoke")
def test_show_driver(self):
- resp, driver = self.client.show_driver(self.driver_name)
- self.assertEqual('200', resp['status'])
+ _, driver = self.client.show_driver(self.driver_name)
self.assertEqual(self.driver_name, driver['name'])
diff --git a/tempest/api/baremetal/admin/test_nodes.py b/tempest/api/baremetal/admin/test_nodes.py
index fc67854..43ea1e6 100644
--- a/tempest/api/baremetal/admin/test_nodes.py
+++ b/tempest/api/baremetal/admin/test_nodes.py
@@ -40,30 +40,25 @@
'storage': '10240',
'memory': '1024'}
- resp, body = self.create_node(self.chassis['uuid'], **params)
- self.assertEqual('201', resp['status'])
+ _, body = self.create_node(self.chassis['uuid'], **params)
self._assertExpected(params, body['properties'])
@test.attr(type='smoke')
def test_delete_node(self):
- resp, node = self.create_node(self.chassis['uuid'])
- self.assertEqual('201', resp['status'])
+ _, node = self.create_node(self.chassis['uuid'])
- resp = self.delete_node(node['uuid'])
+ self.delete_node(node['uuid'])
- self.assertEqual(resp['status'], '204')
self.assertRaises(exc.NotFound, self.client.show_node, node['uuid'])
@test.attr(type='smoke')
def test_show_node(self):
- resp, loaded_node = self.client.show_node(self.node['uuid'])
- self.assertEqual('200', resp['status'])
+ _, loaded_node = self.client.show_node(self.node['uuid'])
self._assertExpected(self.node, loaded_node)
@test.attr(type='smoke')
def test_list_nodes(self):
- resp, body = self.client.list_nodes()
- self.assertEqual('200', resp['status'])
+ _, body = self.client.list_nodes()
self.assertIn(self.node['uuid'],
[i['uuid'] for i in body['nodes']])
@@ -74,24 +69,20 @@
'storage': '10',
'memory': '128'}
- resp, node = self.create_node(self.chassis['uuid'], **props)
- self.assertEqual('201', resp['status'])
+ _, node = self.create_node(self.chassis['uuid'], **props)
new_p = {'cpu_arch': 'x86',
'cpu_num': '1',
'storage': '10000',
'memory': '12300'}
- resp, body = self.client.update_node(node['uuid'], properties=new_p)
- self.assertEqual('200', resp['status'])
- resp, node = self.client.show_node(node['uuid'])
- self.assertEqual('200', resp['status'])
+ _, body = self.client.update_node(node['uuid'], properties=new_p)
+ _, node = self.client.show_node(node['uuid'])
self._assertExpected(new_p, node['properties'])
@test.attr(type='smoke')
def test_validate_driver_interface(self):
- resp, body = self.client.validate_driver_interface(self.node['uuid'])
- self.assertEqual('200', resp['status'])
+ _, body = self.client.validate_driver_interface(self.node['uuid'])
core_interfaces = ['power', 'deploy']
for interface in core_interfaces:
self.assertIn(interface, body)
diff --git a/tempest/api/baremetal/admin/test_nodestates.py b/tempest/api/baremetal/admin/test_nodestates.py
index f24f490..76f47f9 100644
--- a/tempest/api/baremetal/admin/test_nodestates.py
+++ b/tempest/api/baremetal/admin/test_nodestates.py
@@ -24,8 +24,8 @@
@classmethod
def setUpClass(cls):
super(TestNodeStates, cls).setUpClass()
- resp, cls.chassis = cls.create_chassis()
- resp, cls.node = cls.create_node(cls.chassis['uuid'])
+ _, cls.chassis = cls.create_chassis()
+ _, cls.node = cls.create_node(cls.chassis['uuid'])
def _validate_power_state(self, node_uuid, power_state):
# Validate that power state is set within timeout
@@ -34,8 +34,7 @@
start = timeutils.utcnow()
while timeutils.delta_seconds(
start, timeutils.utcnow()) < self.power_timeout:
- resp, node = self.client.show_node(node_uuid)
- self.assertEqual(200, resp.status)
+ _, node = self.client.show_node(node_uuid)
if node['power_state'] == power_state:
return
message = ('Failed to set power state within '
@@ -44,20 +43,16 @@
@test.attr(type='smoke')
def test_list_nodestates(self):
- resp, nodestates = self.client.list_nodestates(self.node['uuid'])
- self.assertEqual('200', resp['status'])
+ _, nodestates = self.client.list_nodestates(self.node['uuid'])
for key in nodestates:
self.assertEqual(nodestates[key], self.node[key])
@test.attr(type='smoke')
def test_set_node_power_state(self):
- resp, node = self.create_node(self.chassis['uuid'])
- self.assertEqual('201', resp['status'])
+ _, node = self.create_node(self.chassis['uuid'])
states = ["power on", "rebooting", "power off"]
for state in states:
# Set power state
- resp, _ = self.client.set_node_power_state(node['uuid'],
- state)
- self.assertEqual('202', resp['status'])
+ self.client.set_node_power_state(node['uuid'], state)
# Check power state after state is set
self._validate_power_state(node['uuid'], state)
diff --git a/tempest/api/baremetal/admin/test_ports.py b/tempest/api/baremetal/admin/test_ports.py
index d4adba9..b3f9b7f 100644
--- a/tempest/api/baremetal/admin/test_ports.py
+++ b/tempest/api/baremetal/admin/test_ports.py
@@ -39,12 +39,10 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address)
- resp, body = self.client.show_port(port['uuid'])
+ _, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
self._assertExpected(port, body)
@test.attr(type='smoke')
@@ -53,12 +51,10 @@
address = data_utils.rand_mac_address()
uuid = data_utils.rand_uuid()
- resp, port = self.create_port(node_id=node_id,
- address=address, uuid=uuid)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id,
+ address=address, uuid=uuid)
- resp, body = self.client.show_port(uuid)
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(uuid)
self._assertExpected(port, body)
@test.attr(type='smoke')
@@ -67,44 +63,37 @@
address = data_utils.rand_mac_address()
extra = {'key': 'value'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port['uuid'])
self._assertExpected(port, body)
@test.attr(type='smoke')
def test_delete_port(self):
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address)
- resp = self.delete_port(port['uuid'])
+ self.delete_port(port['uuid'])
- self.assertEqual(204, resp.status)
self.assertRaises(exc.NotFound, self.client.show_port, port['uuid'])
@test.attr(type='smoke')
def test_show_port(self):
- resp, port = self.client.show_port(self.port['uuid'])
- self.assertEqual(200, resp.status)
+ _, port = self.client.show_port(self.port['uuid'])
self._assertExpected(self.port, port)
@test.attr(type='smoke')
def test_show_port_with_links(self):
- resp, port = self.client.show_port(self.port['uuid'])
- self.assertEqual(200, resp.status)
+ _, port = self.client.show_port(self.port['uuid'])
self.assertIn('links', port.keys())
self.assertEqual(2, len(port['links']))
self.assertIn(port['uuid'], port['links'][0]['href'])
@test.attr(type='smoke')
def test_list_ports(self):
- resp, body = self.client.list_ports()
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_ports()
self.assertIn(self.port['uuid'],
[i['uuid'] for i in body['ports']])
# Verify self links.
@@ -114,8 +103,7 @@
@test.attr(type='smoke')
def test_list_with_limit(self):
- resp, body = self.client.list_ports(limit=3)
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_ports(limit=3)
next_marker = body['ports'][-1]['uuid']
self.assertIn(next_marker, body['next'])
@@ -128,8 +116,7 @@
address=data_utils.rand_mac_address())
[1]['uuid'] for i in range(0, 5)]
- resp, body = self.client.list_ports_detail()
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_ports_detail()
ports_dict = dict((port['uuid'], port) for port in body['ports']
if port['uuid'] in uuids)
@@ -153,8 +140,7 @@
self.create_port(node_id=node_id,
address=data_utils.rand_mac_address())
- resp, body = self.client.list_ports_detail(address=address)
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_ports_detail(address=address)
self.assertEqual(1, len(body['ports']))
self.assertEqual(address, body['ports'][0]['address'])
@@ -164,9 +150,8 @@
address = data_utils.rand_mac_address()
extra = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
new_address = data_utils.rand_mac_address()
new_extra = {'key1': 'new-value1', 'key2': 'new-value2',
@@ -185,11 +170,9 @@
'op': 'replace',
'value': new_extra['key3']}]
- resp, _ = self.client.update_port(port['uuid'], patch)
- self.assertEqual(200, resp.status)
+ self.client.update_port(port['uuid'], patch)
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port['uuid'])
self.assertEqual(new_address, body['address'])
self.assertEqual(new_extra, body['extra'])
@@ -199,26 +182,21 @@
address = data_utils.rand_mac_address()
extra = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
# Removing one item from the collection
- resp, _ = self.client.update_port(port['uuid'],
- [{'path': '/extra/key2',
- 'op': 'remove'}])
- self.assertEqual(200, resp.status)
+ self.client.update_port(port['uuid'],
+ [{'path': '/extra/key2',
+ 'op': 'remove'}])
extra.pop('key2')
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port['uuid'])
self.assertEqual(extra, body['extra'])
# Removing the collection
- resp, _ = self.client.update_port(port['uuid'], [{'path': '/extra',
- 'op': 'remove'}])
- self.assertEqual(200, resp.status)
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ self.client.update_port(port['uuid'], [{'path': '/extra',
+ 'op': 'remove'}])
+ _, body = self.client.show_port(port['uuid'])
self.assertEqual({}, body['extra'])
# Assert nothing else was changed
@@ -230,8 +208,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address)
extra = {'key1': 'value1', 'key2': 'value2'}
@@ -242,11 +219,9 @@
'op': 'add',
'value': extra['key2']}]
- resp, _ = self.client.update_port(port['uuid'], patch)
- self.assertEqual(200, resp.status)
+ self.client.update_port(port['uuid'], patch)
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port['uuid'])
self.assertEqual(extra, body['extra'])
@test.attr(type='smoke')
@@ -255,9 +230,8 @@
address = data_utils.rand_mac_address()
extra = {'key1': 'value1', 'key2': 'value2'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual(201, resp.status)
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
new_address = data_utils.rand_mac_address()
new_extra = {'key1': 'new-value1', 'key3': 'new-value3'}
@@ -274,10 +248,8 @@
'op': 'add',
'value': new_extra['key3']}]
- resp, _ = self.client.update_port(port['uuid'], patch)
- self.assertEqual(200, resp.status)
+ self.client.update_port(port['uuid'], patch)
- resp, body = self.client.show_port(port['uuid'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port['uuid'])
self.assertEqual(new_address, body['address'])
self.assertEqual(new_extra, body['extra'])
diff --git a/tempest/api/baremetal/admin/test_ports_negative.py b/tempest/api/baremetal/admin/test_ports_negative.py
index 7646677..ead3799 100644
--- a/tempest/api/baremetal/admin/test_ports_negative.py
+++ b/tempest/api/baremetal/admin/test_ports_negative.py
@@ -22,11 +22,8 @@
def setUp(self):
super(TestPortsNegative, self).setUp()
- resp, self.chassis = self.create_chassis()
- self.assertEqual('201', resp['status'])
-
- resp, self.node = self.create_node(self.chassis['uuid'])
- self.assertEqual('201', resp['status'])
+ _, self.chassis = self.create_chassis()
+ _, self.node = self.create_node(self.chassis['uuid'])
@test.attr(type=['negative', 'smoke'])
def test_create_port_malformed_mac(self):
@@ -137,13 +134,11 @@
address = data_utils.rand_mac_address()
extra = {'key': 'value'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
port_id = port['uuid']
- resp, body = self.client.delete_port(port_id)
- self.assertEqual('204', resp['status'])
+ _, body = self.client.delete_port(port_id)
patch = [{'path': '/extra/key',
'op': 'replace',
@@ -169,8 +164,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -182,8 +176,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -196,8 +189,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -209,8 +201,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/node_uuid',
@@ -225,11 +216,9 @@
address1 = data_utils.rand_mac_address()
address2 = data_utils.rand_mac_address()
- resp, port1 = self.create_port(node_id=node_id, address=address1)
- self.assertEqual('201', resp['status'])
+ _, port1 = self.create_port(node_id=node_id, address=address1)
- resp, port2 = self.create_port(node_id=node_id, address=address2)
- self.assertEqual('201', resp['status'])
+ _, port2 = self.create_port(node_id=node_id, address=address2)
port_id = port2['uuid']
patch = [{'path': '/address',
@@ -243,8 +232,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/node_uuid',
@@ -258,8 +246,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/address',
@@ -275,9 +262,8 @@
address = data_utils.rand_mac_address()
extra = {'key': 'value'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
port_id = port['uuid']
patch = [{'path': '/extra/key',
@@ -291,8 +277,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/extra',
@@ -307,8 +292,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
patch = [{'path': '/nonexistent', ' op': 'replace', 'value': 'value'}]
@@ -321,8 +305,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -333,8 +316,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -345,8 +327,7 @@
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
- resp, port = self.create_port(node_id=node_id, address=address)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address)
port_id = port['uuid']
self.assertRaises(exc.BadRequest, self.client.update_port, port_id,
@@ -366,9 +347,8 @@
address = data_utils.rand_mac_address()
extra = {'key1': 'value1', 'key2': 'value2'}
- resp, port = self.create_port(node_id=node_id, address=address,
- extra=extra)
- self.assertEqual('201', resp['status'])
+ _, port = self.create_port(node_id=node_id, address=address,
+ extra=extra)
port_id = port['uuid']
new_address = data_utils.rand_mac_address()
@@ -393,7 +373,6 @@
patch)
# patch should not be applied
- resp, body = self.client.show_port(port_id)
- self.assertEqual(200, resp.status)
+ _, body = self.client.show_port(port_id)
self.assertEqual(address, body['address'])
self.assertEqual(extra, body['extra'])
diff --git a/tempest/api/compute/admin/test_flavors_negative.py b/tempest/api/compute/admin/test_flavors_negative.py
index 9e4412f..eece096 100644
--- a/tempest/api/compute/admin/test_flavors_negative.py
+++ b/tempest/api/compute/admin/test_flavors_negative.py
@@ -16,6 +16,7 @@
import uuid
from tempest.api.compute import base
+from tempest.api_schema.request.compute.v2 import flavors
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest import test
@@ -106,4 +107,4 @@
test.NegativeAutoTest):
_interface = 'json'
_service = 'compute'
- _schema_file = 'compute/admin/flavor_create.json'
+ _schema = flavors.flavor_create
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 599b058..4afda03 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -94,6 +94,7 @@
@test.skip_because(bug="1186354",
condition=CONF.service_available.neutron)
@test.attr(type='gate')
+ @test.services('network')
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
@@ -120,6 +121,7 @@
@test.skip_because(bug="1186354",
condition=CONF.service_available.neutron)
@test.attr(type=['negative', 'gate'])
+ @test.services('network')
def test_security_groups_rules_exceed_limit(self):
# Negative test: Creation of Security Group Rules should FAIL
# when we reach limit maxSecurityGroupRules
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 07408a8..a07d270 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -55,7 +55,7 @@
@test.attr(type='smoke')
def test_create_delete_security_group_default_rules(self):
# Create and delete Security Group default rule
- ip_protocols = {'tcp', 'udp', 'icmp'}
+ ip_protocols = ['tcp', 'udp', 'icmp']
for ip_protocol in ip_protocols:
rule = self._create_security_group_default_rules(ip_protocol)
# Delete Security Group default rule
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f684a5a..fd6df3e 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -259,6 +259,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting not available, backup not possible.')
@test.attr(type='gate')
+ @test.services('image')
def test_create_backup(self):
# Positive test:create backup successfully and rotate backups correctly
# create the first and the second backup
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index ab98d88..b737888 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -54,7 +54,6 @@
# Server for positive tests
resp, server = cls.create_test_server(wait_until='BUILD')
- resp, resc_server = cls.create_test_server(wait_until='ACTIVE')
cls.server_id = server['id']
cls.password = server['adminPass']
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
diff --git a/tempest/api/compute/servers/test_servers_negative_new.py b/tempest/api/compute/servers/test_servers_negative_new.py
index 43ddb3a..c5f9fdd 100644
--- a/tempest/api/compute/servers/test_servers_negative_new.py
+++ b/tempest/api/compute/servers/test_servers_negative_new.py
@@ -15,6 +15,7 @@
from tempest.api.compute import base
+from tempest.api_schema.request.compute.v2 import servers
from tempest import test
@@ -25,7 +26,7 @@
class GetConsoleOutputNegativeTestJSON(base.BaseV2ComputeTest,
test.NegativeAutoTest):
_service = 'compute'
- _schema_file = 'compute/servers/get_console_output.json'
+ _schema = servers.get_console_output
@classmethod
def setUpClass(cls):
diff --git a/tempest/api/network/common.py b/tempest/api/network/common.py
index 97e120f..5ac8b5a 100644
--- a/tempest/api/network/common.py
+++ b/tempest/api/network/common.py
@@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+import abc
+
+import six
+
class AttributeDict(dict):
@@ -27,6 +31,7 @@
return super(AttributeDict, self).__getattribute__(name)
+@six.add_metaclass(abc.ABCMeta)
class DeletableResource(AttributeDict):
"""
@@ -42,8 +47,9 @@
return '<%s id="%s" name="%s">' % (self.__class__.__name__,
self.id, self.name)
+ @abc.abstractmethod
def delete(self):
- raise NotImplemented()
+ return
def __hash__(self):
return id(self)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index cfebc2c..a091ce1 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -86,8 +86,11 @@
pass
for stack_identifier in cls.stacks:
- cls.client.wait_for_stack_status(
- stack_identifier, 'DELETE_COMPLETE')
+ try:
+ cls.client.wait_for_stack_status(
+ stack_identifier, 'DELETE_COMPLETE')
+ except exceptions.NotFound:
+ pass
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
diff --git a/tempest/api_schema/request/compute/flavors.py b/tempest/api_schema/request/compute/flavors.py
index 36e5a19..8fe9e3a 100644
--- a/tempest/api_schema/request/compute/flavors.py
+++ b/tempest/api_schema/request/compute/flavors.py
@@ -30,3 +30,24 @@
}
}
}
+
+common_admin_flavor_create = {
+ "name": "flavor-create",
+ "http-method": "POST",
+ "admin_client": True,
+ "url": "flavors",
+ "default_result_code": 400,
+ "json-schema": {
+ "type": "object",
+ "properties": {
+ "name": {"type": "string"},
+ "ram": {"type": "integer", "minimum": 1},
+ "vcpus": {"type": "integer", "minimum": 1},
+ "disk": {"type": "integer"},
+ "id": {"type": "integer"},
+ "swap": {"type": "integer"},
+ "rxtx_factor": {"type": "integer"},
+ "OS-FLV-EXT-DATA:ephemeral": {"type": "integer"}
+ }
+ }
+}
diff --git a/tempest/api_schema/request/compute/servers.py b/tempest/api_schema/request/compute/servers.py
new file mode 100644
index 0000000..731649c
--- /dev/null
+++ b/tempest/api_schema/request/compute/servers.py
@@ -0,0 +1,36 @@
+# (c) 2014 Deutsche Telekom AG
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+common_get_console_output = {
+ "name": "get-console-output",
+ "http-method": "POST",
+ "url": "servers/%s/action",
+ "resources": [
+ {"name": "server", "expected_result": 404}
+ ],
+ "json-schema": {
+ "type": "object",
+ "properties": {
+ "os-getConsoleOutput": {
+ "type": "object",
+ "properties": {
+ "length": {
+ "type": ["integer", "string"],
+ "minimum": 0
+ }
+ }
+ }
+ },
+ "additionalProperties": False
+ }
+}
diff --git a/tempest/api_schema/request/compute/v2/flavors.py b/tempest/api_schema/request/compute/v2/flavors.py
index 08f6c28..bc459ad 100644
--- a/tempest/api_schema/request/compute/v2/flavors.py
+++ b/tempest/api_schema/request/compute/v2/flavors.py
@@ -19,6 +19,8 @@
flavor_list = copy.deepcopy(flavors.common_flavor_list)
+flavor_create = copy.deepcopy(flavors.common_admin_flavor_create)
+
flavor_list["json-schema"]["properties"] = {
"minRam": {
"type": "integer",
diff --git a/tempest/api_schema/request/compute/v2/servers.py b/tempest/api_schema/request/compute/v2/servers.py
new file mode 100644
index 0000000..c9002ed
--- /dev/null
+++ b/tempest/api_schema/request/compute/v2/servers.py
@@ -0,0 +1,18 @@
+# (c) 2014 Deutsche Telekom AG
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import copy
+
+from tempest.api_schema.request.compute import servers
+
+get_console_output = copy.deepcopy(servers.common_get_console_output)
diff --git a/tempest/cli/simple_read_only/test_ceilometer.py b/tempest/cli/simple_read_only/test_ceilometer.py
index 1d2822d..b622dd4 100644
--- a/tempest/cli/simple_read_only/test_ceilometer.py
+++ b/tempest/cli/simple_read_only/test_ceilometer.py
@@ -39,15 +39,19 @@
raise cls.skipException(msg)
super(SimpleReadOnlyCeilometerClientTest, cls).setUpClass()
+ @test.services('telemetry')
def test_ceilometer_meter_list(self):
self.ceilometer('meter-list')
@test.attr(type='slow')
+ @test.services('telemetry')
def test_ceilometer_resource_list(self):
self.ceilometer('resource-list')
+ @test.services('telemetry')
def test_ceilometermeter_alarm_list(self):
self.ceilometer('alarm-list')
+ @test.services('telemetry')
def test_ceilometer_version(self):
self.ceilometer('', flags='--version')
diff --git a/tempest/common/generator/valid_generator.py b/tempest/common/generator/valid_generator.py
index a99bbc0..0d7b398 100644
--- a/tempest/common/generator/valid_generator.py
+++ b/tempest/common/generator/valid_generator.py
@@ -24,7 +24,7 @@
@base.generator_type("string")
@base.simple_generator
def generate_valid_string(self, schema):
- size = schema.get("minLength", 0)
+ size = schema.get("minLength", 1)
# TODO(dkr mko): handle format and pattern
return "x" * size
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index f711f2f..d5e49db 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -162,9 +162,11 @@
email = data_utils.rand_name(root) + suffix + "@example.com"
user = self._create_user(username, self.password,
tenant, email)
- # NOTE(andrey-mp): user needs this role to create containers in swift
- swift_operator_role = CONF.object_storage.operator_role
- self._assign_user_role(tenant, user, swift_operator_role)
+ if CONF.service_available.swift:
+ # NOTE(andrey-mp): user needs this role to create containers
+ # in swift
+ swift_operator_role = CONF.object_storage.operator_role
+ self._assign_user_role(tenant, user, swift_operator_role)
if admin:
self._assign_user_role(tenant, user, CONF.identity.admin_role)
return self._get_credentials(user, tenant)
diff --git a/tempest/config.py b/tempest/config.py
index 2412955..4836c63 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -1083,6 +1083,10 @@
DEFAULT_CONFIG_FILE = "tempest.conf"
+ def __getattr__(self, attr):
+ # Handles config options from the default group
+ return getattr(cfg.CONF, attr)
+
def _set_attrs(self):
self.auth = cfg.CONF.auth
self.compute = cfg.CONF.compute
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index bc8872d..982ded6 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -823,7 +823,7 @@
ip = server_or_ip
else:
network_name_for_ssh = CONF.compute.network_for_ssh
- ip = server_or_ip['networks'][network_name_for_ssh][0]
+ ip = server_or_ip.networks[network_name_for_ssh][0]
if username is None:
username = CONF.scenario.ssh_user
if private_key is None:
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index fc6c66c..bba034b 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -22,6 +22,7 @@
from tempest.common import debug
from tempest.common.utils import data_utils
from tempest import config
+from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest import test
@@ -222,23 +223,31 @@
self.addCleanup(self.delete_wrapper, server)
def check_ports():
- port_list = [port for port in
- self._list_ports(device_id=server.id)
- if port != old_port]
- return len(port_list) == 1
+ self.new_port_list = [port for port in
+ self._list_ports(device_id=server.id)
+ if port != old_port]
+ return len(self.new_port_list) == 1
- test.call_until_true(check_ports, 60, 1)
- new_port_list = [p for p in
- self._list_ports(device_id=server.id)
- if p != old_port]
- self.assertEqual(1, len(new_port_list))
- new_port = new_port_list[0]
+ if not test.call_until_true(check_ports, CONF.network.build_timeout,
+ CONF.network.build_interval):
+ raise exceptions.TimeoutException("No new port attached to the "
+ "server in time (%s sec) !"
+ % CONF.network.build_timeout)
new_port = net_common.DeletablePort(client=self.network_client,
- **new_port)
- new_nic_list = self._get_server_nics(ssh_client)
- diff_list = [n for n in new_nic_list if n not in old_nic_list]
- self.assertEqual(1, len(diff_list))
- num, new_nic = diff_list[0]
+ **self.new_port_list[0])
+
+ def check_new_nic():
+ new_nic_list = self._get_server_nics(ssh_client)
+ self.diff_list = [n for n in new_nic_list if n not in old_nic_list]
+ return len(self.diff_list) == 1
+
+ if not test.call_until_true(check_new_nic, CONF.network.build_timeout,
+ CONF.network.build_interval):
+ raise exceptions.TimeoutException("Interface not visible on the "
+ "guest after %s sec"
+ % CONF.network.build_timeout)
+
+ num, new_nic = self.diff_list[0]
ssh_client.assign_static_ip(nic=new_nic,
addr=new_port.fixed_ips[0]['ip_address'])
ssh_client.turn_nic_on(nic=new_nic)
diff --git a/tempest/scenario/test_swift_basic_ops.py b/tempest/scenario/test_swift_basic_ops.py
index 86e0867..b5f3a07 100644
--- a/tempest/scenario/test_swift_basic_ops.py
+++ b/tempest/scenario/test_swift_basic_ops.py
@@ -25,7 +25,7 @@
LOG = logging.getLogger(__name__)
-class TestSwiftBasicOps(manager.OfficialClientTest):
+class TestSwiftBasicOps(manager.ScenarioTest):
"""
Test swift with the follow operations:
* get swift stat.
@@ -46,34 +46,37 @@
skip_msg = ("%s skipped as swift is not available" %
cls.__name__)
raise cls.skipException(skip_msg)
+ # Clients for Swift
+ cls.account_client = cls.manager.account_client
+ cls.container_client = cls.manager.container_client
+ cls.object_client = cls.manager.object_client
def _get_swift_stat(self):
"""get swift status for our user account."""
- self.object_storage_client.get_account()
+ self.account_client.list_account_containers()
LOG.debug('Swift status information obtained successfully')
def _create_container(self, container_name=None):
name = container_name or data_utils.rand_name(
'swift-scenario-container')
- self.object_storage_client.put_container(name)
+ self.container_client.create_container(name)
# look for the container to assure it is created
self._list_and_check_container_objects(name)
LOG.debug('Container %s created' % (name))
return name
def _delete_container(self, container_name):
- self.object_storage_client.delete_container(container_name)
+ self.container_client.delete_container(container_name)
LOG.debug('Container %s deleted' % (container_name))
def _upload_object_to_container(self, container_name, obj_name=None):
obj_name = obj_name or data_utils.rand_name('swift-scenario-object')
- self.object_storage_client.put_object(container_name, obj_name,
- data_utils.rand_name('obj_data'),
- content_type='text/plain')
+ self.object_client.create_object(container_name, obj_name,
+ data_utils.arbitrary_string())
return obj_name
def _delete_object(self, container_name, filename):
- self.object_storage_client.delete_object(container_name, filename)
+ self.object_client.delete_object(container_name, filename)
self._list_and_check_container_objects(container_name,
not_present_obj=[filename])
@@ -83,10 +86,8 @@
List objects for a given container and assert which are present and
which are not.
"""
- meta, response = self.object_storage_client.get_container(
+ _, object_list = self.container_client.list_container_contents(
container_name)
- # create a list with file name only
- object_list = [obj['name'] for obj in response]
if present_obj:
for obj in present_obj:
self.assertIn(obj, object_list)
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index f98ecff..0b97f74 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -119,6 +119,7 @@
uri += "?%s" % urllib.urlencode(kwargs)
resp, body = self.get(uri)
+ self.expected_success(200, resp['status'])
return resp, self.deserialize(body)
@@ -135,6 +136,7 @@
else:
uri = self._get_uri(resource, uuid=uuid, permanent=permanent)
resp, body = self.get(uri)
+ self.expected_success(200, resp['status'])
return resp, self.deserialize(body)
@@ -153,6 +155,7 @@
uri = self._get_uri(resource)
resp, body = self.post(uri, body=body)
+ self.expected_success(201, resp['status'])
return resp, self.deserialize(body)
@@ -168,6 +171,7 @@
uri = self._get_uri(resource, uuid)
resp, body = self.delete(uri)
+ self.expected_success(204, resp['status'])
return resp, body
def _patch_request(self, resource, uuid, patch_object):
@@ -184,6 +188,7 @@
patch_body = json.dumps(patch_object)
resp, body = self.patch(uri, body=patch_body)
+ self.expected_success(200, resp['status'])
return resp, self.deserialize(body)
@handle_errors
@@ -212,4 +217,5 @@
put_body = json.dumps(put_object)
resp, body = self.put(uri, body=put_body)
+ self.expected_success(202, resp['status'])
return resp, body
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index d57b931..0522f37 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -525,7 +525,7 @@
def __init__(self):
super(V3TokenClientJSON, self).__init__(None)
auth_url = CONF.identity.uri_v3
- if not auth_url and CONF.identity_feature_enabled.api_v3:
+ if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
'if using the v3 identity '
'api')
diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py
index c2bd77e..5b761b3 100644
--- a/tempest/services/identity/v3/xml/identity_client.py
+++ b/tempest/services/identity/v3/xml/identity_client.py
@@ -520,7 +520,7 @@
def __init__(self):
super(V3TokenClientXML, self).__init__(None)
auth_url = CONF.identity.uri_v3
- if not auth_url and CONF.identity_feature_enabled.api_v3:
+ if not auth_url:
raise exceptions.InvalidConfiguration('you must specify a v3 uri '
'if using the v3 identity '
'api')
diff --git a/tempest/stress/stressaction.py b/tempest/stress/stressaction.py
index f6770ab..286e022 100644
--- a/tempest/stress/stressaction.py
+++ b/tempest/stress/stressaction.py
@@ -12,12 +12,16 @@
# License for the specific language governing permissions and limitations
# under the License.
+import abc
import signal
import sys
+import six
+
from tempest.openstack.common import log as logging
+@six.add_metaclass(abc.ABCMeta)
class StressAction(object):
def __init__(self, manager, max_runs=None, stop_on_error=False):
@@ -83,6 +87,7 @@
self.tearDown()
sys.exit(1)
+ @abc.abstractmethod
def run(self):
"""This method is where the stress test code runs."""
- raise NotImplemented()
+ return
diff --git a/tempest/test.py b/tempest/test.py
index 1e67d18..59da2f9 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -107,7 +107,7 @@
'identity': True,
'object_storage': CONF.service_available.swift,
'dashboard': CONF.service_available.horizon,
- 'ceilometer': CONF.service_available.ceilometer,
+ 'telemetry': CONF.service_available.ceilometer,
'data_processing': CONF.service_available.sahara
}
diff --git a/tox.ini b/tox.ini
index edcb901..a071d4b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -32,7 +32,6 @@
[testenv:all]
sitepackages = True
-setenv = VIRTUAL_ENV={envdir}
commands =
bash tools/pretty_tox.sh '{posargs}'