Merge "Add test for performance in constraint validation"

This commit is contained in:
Jenkins 2016-02-18 12:18:26 +00:00 committed by Gerrit Code Review
commit 751bd3a922
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

@ -24,3 +24,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