Merge "Add a tox job to run stress tests."
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 5f53080..5cc8dc6 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -24,12 +24,12 @@
from tempest.test import attr
-class ServersNegativeTest(base.BaseComputeTest):
+class ServersNegativeTestJSON(base.BaseComputeTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
- super(ServersNegativeTest, cls).setUpClass()
+ super(ServersNegativeTestJSON, cls).setUpClass()
cls.client = cls.servers_client
cls.img_client = cls.images_client
cls.alt_os = clients.AltManager()
@@ -248,5 +248,5 @@
'999erra43')
-class ServersNegativeTestXML(ServersNegativeTest):
+class ServersNegativeTestXML(ServersNegativeTestJSON):
_interface = 'xml'
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index c029300..0bba250 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -15,7 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import testtools
from testtools.matchers._basic import Contains
from tempest.api.identity import base
@@ -77,32 +76,6 @@
self.data.test_user, self.data.test_password,
self.data.tenant['id'], self.data.test_email)
- @testtools.skip("Until Bug #999084 is fixed")
- @attr(type=['negative', 'gate'])
- def test_create_user_with_empty_password(self):
- # User with an empty password should not be created
- self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
- self.alt_user, '', self.data.tenant['id'],
- self.alt_email)
-
- @testtools.skip("Until Bug #999084 is fixed")
- @attr(type=['negative', 'gate'])
- def test_create_user_with_long_password(self):
- # User having password exceeding max length should not be created
- self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
- self.alt_user, 'a' * 65, self.data.tenant['id'],
- self.alt_email)
-
- @testtools.skip("Until Bug #999084 is fixed")
- @attr(type=['negative', 'gate'])
- def test_create_user_with_invalid_email_format(self):
- # Email format should be validated while creating a user
- self.data.setup_test_tenant()
- self.assertRaises(exceptions.BadRequest, self.client.create_user,
- self.alt_user, '', self.data.tenant['id'], '12345')
-
@attr(type=['negative', 'gate'])
def test_create_user_for_non_existant_tenant(self):
# Attempt to create a user in a non-existent tenant should fail
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index fa8190a..6d6000a 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -33,6 +33,8 @@
cls.orchestration_cfg = os.config.orchestration
if not cls.orchestration_cfg.heat_available:
raise cls.skipException("Heat support is required")
+ cls.build_timeout = cls.orchestration_cfg.build_timeout
+ cls.build_interval = cls.orchestration_cfg.build_interval
cls.os = os
cls.orchestration_client = os.orchestration_client
@@ -60,15 +62,15 @@
cls.config.identity.uri
)
- def create_stack(self, stack_name, template_data, parameters={}):
- resp, body = self.client.create_stack(
+ @classmethod
+ def create_stack(cls, stack_name, template_data, parameters={}):
+ resp, body = cls.client.create_stack(
stack_name,
template=template_data,
parameters=parameters)
- self.assertEqual('201', resp['status'])
stack_id = resp['location'].split('/')[-1]
stack_identifier = '%s/%s' % (stack_name, stack_id)
- self.stacks.append(stack_identifier)
+ cls.stacks.append(stack_identifier)
return stack_identifier
@classmethod
@@ -86,11 +88,11 @@
except Exception:
pass
- def _create_keypair(self, namestart='keypair-heat-'):
+ @classmethod
+ def _create_keypair(cls, namestart='keypair-heat-'):
kp_name = rand_name(namestart)
- resp, body = self.keypairs_client.create_keypair(kp_name)
- self.assertEqual(body['name'], kp_name)
- self.keypairs.append(kp_name)
+ resp, body = cls.keypairs_client.create_keypair(kp_name)
+ cls.keypairs.append(kp_name)
return body
@classmethod
diff --git a/tempest/api/orchestration/stacks/test_instance_cfn_init.py b/tempest/api/orchestration/stacks/test_instance_cfn_init.py
index e3b8162..add8588 100644
--- a/tempest/api/orchestration/stacks/test_instance_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_instance_cfn_init.py
@@ -119,23 +119,21 @@
raise cls.skipException("No image available to test")
cls.client = cls.orchestration_client
- def setUp(self):
- super(InstanceCfnInitTestJSON, self).setUp()
stack_name = rand_name('heat')
- if self.orchestration_cfg.keypair_name:
- keypair_name = self.orchestration_cfg.keypair_name
+ if cls.orchestration_cfg.keypair_name:
+ keypair_name = cls.orchestration_cfg.keypair_name
else:
- self.keypair = self._create_keypair()
- keypair_name = self.keypair['name']
+ cls.keypair = cls._create_keypair()
+ keypair_name = cls.keypair['name']
# create the stack
- self.stack_identifier = self.create_stack(
+ cls.stack_identifier = cls.create_stack(
stack_name,
- self.template,
+ cls.template,
parameters={
'KeyName': keypair_name,
- 'InstanceType': self.orchestration_cfg.instance_type,
- 'ImageId': self.orchestration_cfg.image_ref
+ 'InstanceType': cls.orchestration_cfg.instance_type,
+ 'ImageId': cls.orchestration_cfg.image_ref
})
@attr(type='gate')
diff --git a/tempest/config.py b/tempest/config.py
index 8795b33..f6fd1d9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -15,9 +15,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from __future__ import print_function
+
import os
import sys
+
from oslo.config import cfg
from tempest.common import log as logging
@@ -559,7 +562,7 @@
if not os.path.exists(path):
msg = "Config file %(path)s not found" % locals()
- print >> sys.stderr, RuntimeError(msg)
+ print(RuntimeError(msg), file=sys.stderr)
else:
config_files.append(path)
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 6b0e7e3..22f3f26 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -46,6 +46,35 @@
def create_stack(self, name, disable_rollback=True, parameters={},
timeout_mins=60, template=None, template_url=None):
+ headers, body = self._prepare_update_create(
+ name,
+ disable_rollback,
+ parameters,
+ timeout_mins,
+ template,
+ template_url)
+ uri = 'stacks'
+ resp, body = self.post(uri, headers=headers, body=body)
+ return resp, body
+
+ def update_stack(self, stack_identifier, name, disable_rollback=True,
+ parameters={}, timeout_mins=60, template=None,
+ template_url=None):
+ headers, body = self._prepare_update_create(
+ name,
+ disable_rollback,
+ parameters,
+ timeout_mins,
+ template,
+ template_url)
+
+ uri = "stacks/%s" % stack_identifier
+ resp, body = self.put(uri, headers=headers, body=body)
+ return resp, body
+
+ def _prepare_update_create(self, name, disable_rollback=True,
+ parameters={}, timeout_mins=60,
+ template=None, template_url=None):
post_body = {
"stack_name": name,
"disable_rollback": disable_rollback,
@@ -58,9 +87,13 @@
if template_url:
post_body['template_url'] = template_url
body = json.dumps(post_body)
- uri = 'stacks'
- resp, body = self.post(uri, headers=self.headers, body=body)
- return resp, body
+
+ # Password must be provided on stack create so that heat
+ # can perform future operations on behalf of the user
+ headers = dict(self.headers)
+ headers['X-Auth-Key'] = self.password
+ headers['X-Auth-User'] = self.user
+ return headers, body
def get_stack(self, stack_identifier):
"""Returns the details of a single stack."""