本文整理汇总了Python中testenv.deploy函数的典型用法代码示例。如果您正苦于以下问题:Python deploy函数的具体用法?Python deploy怎么用?Python deploy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deploy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invalid_dsl
def test_invalid_dsl(self):
# note: this actually tests the validation part of the "deploy" command
dsl_path = resource("dsl/invalid-dsl.yaml")
with self.assertRaises(Exception) as cm:
deploy(dsl_path)
self.assertTrue('invalid blueprint' in
cm.exception.message.lower(), cm.exception.message)
示例2: test_execute_operation_failure
def test_execute_operation_failure(self):
from plugins.cloudmock.tasks import set_raise_exception_on_start
send_task(set_raise_exception_on_start).get(timeout=10)
dsl_path = resource("dsl/basic.yaml")
try:
deploy(dsl_path)
self.fail('expected exception')
except Exception:
pass
示例3: test_fail_remote_task_eventual_success
def test_fail_remote_task_eventual_success(self):
deploy(resource('dsl/workflow_api.yaml'), self._testMethodName,
parameters={'do_get': self.do_get})
# testing workflow remote task
invocations = send_task(get_fail_invocations).get()
self.assertEqual(3, len(invocations))
for i in range(len(invocations) - 1):
self.assertLessEqual(1, invocations[i+1] - invocations[i])
示例4: test_start_monitor_node_operation
def test_start_monitor_node_operation(self):
dsl_path = resource("dsl/hardcoded_operation_properties.yaml")
deploy(dsl_path)
from plugins.testmockoperations.tasks import \
get_monitoring_operations_invocation
invocations = send_task(get_monitoring_operations_invocation)\
.get(timeout=10)
self.assertEqual(1, len(invocations))
invocation = invocations[0]
self.assertEqual('start_monitor', invocation['operation'])
示例5: _local_task_fail_impl
def _local_task_fail_impl(self, wf_name):
if self.do_get:
deploy(resource('dsl/workflow_api.yaml'), wf_name,
parameters={'do_get': self.do_get})
else:
self.assertRaises(RuntimeError,
deploy,
resource('dsl/workflow_api.yaml'),
wf_name,
parameters={'do_get': self.do_get})
示例6: test_inject_properties_to_operation
def test_inject_properties_to_operation(self):
dsl_path = resource("dsl/hardcoded_operation_properties.yaml")
deploy(dsl_path)
from plugins.testmockoperations.tasks import get_state as \
testmock_get_state
states = send_task(testmock_get_state).get(timeout=10)
from plugins.testmockoperations.tasks import \
get_mock_operation_invocations as testmock_get__invocations
invocations = send_task(testmock_get__invocations).get(timeout=10)
self.assertEqual(1, len(invocations))
invocation = invocations[0]
self.assertEqual('mockpropvalue', invocation['mockprop'])
self.assertEqual(states[0]['id'], invocation['id'])
示例7: test_deploy_multi_instance_many_different_hosts
def test_deploy_multi_instance_many_different_hosts(self):
dsl_path = resource('dsl/multi_instance_many_different_hosts.yaml')
deploy(dsl_path)
from plugins.cloudmock.tasks import get_machines
result = send_task(get_machines)
machines = set(result.get(timeout=10))
self.assertEquals(15, len(machines))
self.assertEquals(5, len(filter(lambda ma: ma.startswith('host1'),
machines)))
self.assertEquals(5, len(filter(lambda ma: ma.startswith('host2'),
machines)))
self.assertEquals(5, len(filter(lambda ma: ma.startswith('host3'),
machines)))
示例8: test_cancel_on_wait_for_task_termination
def test_cancel_on_wait_for_task_termination(self):
_, eid = deploy(
resource('dsl/workflow_api.yaml'), self._testMethodName,
parameters={'do_get': self.do_get}, wait_for_execution=False)
self.wait_for_execution_status(eid, status=Execution.STARTED)
self.client.executions.cancel(eid)
self.wait_for_execution_status(eid, status=Execution.CANCELLED)
示例9: test_deploy_multi_instance_application
def test_deploy_multi_instance_application(self):
dsl_path = resource("dsl/multi_instance.yaml")
deploy(dsl_path)
from plugins.cloudmock.tasks import get_machines
result = send_task(get_machines)
machines = set(result.get(timeout=10))
self.assertEquals(2, len(machines))
from plugins.testmockoperations.tasks import get_state as get_state
apps_state = send_task(get_state).get(timeout=10)
machines_with_apps = set([])
for app_state in apps_state:
host_id = app_state['capabilities'].keys()[0]
machines_with_apps.add(host_id)
self.assertEquals(machines, machines_with_apps)
示例10: test_policies
def test_policies(self):
dsl_path = resource("dsl/with_policies.yaml")
deployment, _ = deploy(dsl_path)
def assertion():
instances = self.client.node_instances.list(deployment.id)
self.assertEqual(1, len(instances))
self.do_assertions(assertion)
instance = self.client.node_instances.list(deployment.id)[0]
self.publish_riemann_event(deployment.id,
node_name='node',
node_id=instance.id,
metric=123)
def assertion():
executions = self.client.executions.list(deployment.id)
self.assertEqual(3, len(executions))
invocations = send_task(testmock_get_invocations).get(timeout=10)
self.assertEqual(2, len(invocations))
instances = self.client.node_instances.list(deployment.id)
self.assertEqual(1, len(instances))
instance = instances[0]
self.assertEqual(instance.id, invocations[0]['node_id'])
self.assertEqual(123, invocations[1]['metric'])
self.do_assertions(assertion)
示例11: test_update_node_bad_version
def test_update_node_bad_version(self):
deploy(resource("dsl/basic.yaml"))
client = create_rest_client()
instance = client.node_instances.list()[0]
instance = client.node_instances.get(instance.id) # need the version
props = {"key": "value"}
result = client.node_instances.update(
instance.id, state="started", runtime_properties=props, version=instance.version
)
self.assertEquals(instance.version + 1, result.version)
self.assertEquals(instance.id, result.id)
self.assertDictContainsSubset(props, result.runtime_properties)
self.assertEquals("started", result.state)
# making another call with a bad version
self.assertRaises(CloudifyClientError, client.node_instances.update, instance.id, version=1)
示例12: test_cancel_on_task_retry_interval
def test_cancel_on_task_retry_interval(self):
self.configure(retries=2, interval=1000000)
_, eid = deploy(
resource('dsl/workflow_api.yaml'), self._testMethodName,
parameters={'do_get': self.do_get}, wait_for_execution=False)
self.wait_for_execution_status(eid, status=Execution.STARTED)
self.client.executions.cancel(eid)
self.wait_for_execution_status(eid, status=Execution.CANCELLED)
示例13: test_cloudify_runtime_properties_injection
def test_cloudify_runtime_properties_injection(self):
dsl_path = resource("dsl/dependencies_order_with_two_nodes.yaml")
deploy(dsl_path)
from plugins.testmockoperations.tasks import get_state as \
testmock_get_state
states = send_task(testmock_get_state).get(timeout=10)
node_runtime_props = None
for k, v in states[1]['capabilities'].iteritems():
if 'host_node' in k:
node_runtime_props = v
break
self.assertEquals('value1', node_runtime_props['property1'])
self.assertEquals(1,
len(node_runtime_props),
msg='Expected 2 but contains: {0}'.format(
node_runtime_props))
示例14: test_operation_mapping_override
def test_operation_mapping_override(self):
dsl_path = resource("dsl/operation_mapping.yaml")
deployment, _ = deploy(dsl_path, 'workflow2')
invocations = send_task(get_mock_operation_invocations).get()
self.assertEqual(3, len(invocations))
for invocation in invocations:
self.assertEqual(1, len(invocation))
self.assertEqual(invocation['test_key'], 'overridden_test_value')
示例15: test_get_blueprint
def test_get_blueprint(self):
dsl_path = resource("dsl/basic.yaml")
blueprint_id = str(uuid.uuid4())
deployment, _ = deploy(dsl_path, blueprint_id=blueprint_id)
self.assertEqual(blueprint_id, deployment.blueprint_id)
blueprint = self.client.blueprints.get(blueprint_id)
self.assertEqual(blueprint_id, blueprint.id)
self.assertTrue(len(blueprint['plan']) > 0)