本文整理汇总了Python中appscale.tools.local_state.LocalState.generate_deployment_params方法的典型用法代码示例。如果您正苦于以下问题:Python LocalState.generate_deployment_params方法的具体用法?Python LocalState.generate_deployment_params怎么用?Python LocalState.generate_deployment_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.local_state.LocalState
的用法示例。
在下文中一共展示了LocalState.generate_deployment_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_generate_deployment_params
# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import generate_deployment_params [as 别名]
def test_generate_deployment_params(self):
# this method is fairly light, so just make sure that it constructs the dict
# to send to the AppController correctly
options = flexmock(
name='options', table='cassandra', keyname='boo',
default_min_appservers='1', autoscale=False, group='bazgroup',
replication=None, infrastructure='ec2', machine='ami-ABCDEFG',
instance_type='m1.large', use_spot_instances=True, max_spot_price=1.23,
clear_datastore=False, disks={'node-1' : 'vol-ABCDEFG'},
zone='my-zone-1b', verbose=True, user_commands=[], flower_password="abc",
default_max_appserver_memory=ParseArgs.DEFAULT_MAX_APPSERVER_MEMORY,
EC2_ACCESS_KEY='baz', EC2_SECRET_KEY='baz', EC2_URL='',
login_host='public1', aws_subnet_id=None, aws_vpc_id=None)
node_layout = NodeLayout({
'table' : 'cassandra',
'infrastructure' : "ec2",
'min_machines' : 1,
'max_machines' : 1,
'instance_type': 'm1.large'
})
flexmock(NodeLayout).should_receive("head_node").and_return(Node(
'public1', 'some cloud', ['some role']))
expected = {
'table' : 'cassandra',
'login' : 'public1',
'clear_datastore': 'False',
'keyname' : 'boo',
'default_min_appservers' : '1',
'autoscale' : 'False',
'replication': 'None',
'group' : 'bazgroup',
'machine' : 'ami-ABCDEFG',
'infrastructure' : 'ec2',
'instance_type' : 'm1.large',
'min_machines' : '1',
'max_machines' : '1',
'use_spot_instances' : 'True',
'user_commands' : json.dumps([]),
'max_spot_price' : '1.23',
'zone' : 'my-zone-1b',
'verbose' : 'True',
'flower_password' : 'abc',
'default_max_appserver_memory' : str(ParseArgs.DEFAULT_MAX_APPSERVER_MEMORY),
'EC2_ACCESS_KEY': 'baz',
'EC2_SECRET_KEY': 'baz',
'EC2_URL': '',
'aws_subnet_id': None,
'aws_vpc_id': None
}
actual = LocalState.generate_deployment_params(options, node_layout,
{'max_spot_price':'1.23'})
self.assertEquals(expected, actual)