Add test for performance in constraint validation

There are follow important changes in patch:
 - New constraint was added. This constraint emulate delay during
   resolving custom constraint for property.
 - New property was added for TestResource. This property uses new
   constraint.
 - Added Rally scenario create-delete, which uses template with
   ResourceGroup of TestResources with custom constraint.


Depends-On: I06183138d54c1cb971a58a158a15f3f5b25cba4d

Change-Id: I53d83f59be9bd27db451f87aaae2d8446f287c17
This commit is contained in:
Sergey Kraynev 2016-02-12 05:04:01 -05:00
parent 14f3bb75a3
commit fbb1a49424
5 changed files with 52 additions and 0 deletions

View File

@ -12,6 +12,7 @@
# under the License.
import croniter
import eventlet
import netaddr
import pytz
import six
@ -23,6 +24,12 @@ from heat.common.i18n import _
from heat.engine import constraints
class TestConstraintDelay(constraints.BaseCustomConstraint):
def validate_with_client(self, client, value):
eventlet.sleep(value)
class IPConstraint(constraints.BaseCustomConstraint):
def validate(self, value, context):

View File

@ -18,6 +18,7 @@ import six
from heat.common.i18n import _
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
@ -44,10 +45,12 @@ class TestResource(resource.Resource):
VALUE, UPDATE_REPLACE, FAIL,
CLIENT_NAME, ENTITY_NAME,
WAIT_SECS, ACTION_WAIT_SECS, ATTR_WAIT_SECS,
CONSTRAINT_PROP_SECS,
) = (
'value', 'update_replace', 'fail',
'client_name', 'entity_name',
'wait_secs', 'action_wait_secs', 'attr_wait_secs',
'constraint_prop_secs',
)
ATTRIBUTES = (
@ -57,6 +60,16 @@ class TestResource(resource.Resource):
)
properties_schema = {
CONSTRAINT_PROP_SECS: properties.Schema(
properties.Schema.NUMBER,
_('Number value for delay during resolve constraint.'),
default=0,
update_allowed=True,
constraints=[
constraints.CustomConstraint('test_constr')
],
support_status=support.SupportStatus(version='6.0.0')
),
ATTR_WAIT_SECS: properties.Schema(
properties.Schema.NUMBER,
_('Number value for timeout during resolving output value.'),

View File

@ -0,0 +1,19 @@
heat_template_version: 2013-05-23
description: Template for testing caching.
parameters:
count:
type: number
default: 40
delay:
type: number
default: 0.3
resources:
rg:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: count}
resource_def:
type: OS::Heat::TestResource
properties:
constraint_prop_secs: {get_param: delay}

View File

@ -20,3 +20,15 @@
users:
tenants: 10
users_per_tenant: 3
-
args:
template_path: "~/.rally/extra/rg_template_with_constraint.yaml"
runner:
type: "constant"
times: 10
concurrency: 2
context:
users:
tenants: 1
users_per_tenant: 1

View File

@ -103,6 +103,7 @@ heat.constraints =
ip_addr = heat.engine.constraint.common_constraints:IPConstraint
mac_addr = heat.engine.constraint.common_constraints:MACConstraint
net_cidr = heat.engine.constraint.common_constraints:CIDRConstraint
test_constr = heat.engine.constraint.common_constraints:TestConstraintDelay
keystone.role = heat.engine.clients.os.keystone:KeystoneRoleConstraint
keystone.domain = heat.engine.clients.os.keystone:KeystoneDomainConstraint
keystone.project = heat.engine.clients.os.keystone:KeystoneProjectConstraint