本文整理匯總了Python中apache.aurora.config.AuroraConfig.load方法的典型用法代碼示例。如果您正苦於以下問題:Python AuroraConfig.load方法的具體用法?Python AuroraConfig.load怎麽用?Python AuroraConfig.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類apache.aurora.config.AuroraConfig
的用法示例。
在下文中一共展示了AuroraConfig.load方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_simple_config
# 需要導入模塊: from apache.aurora.config import AuroraConfig [as 別名]
# 或者: from apache.aurora.config.AuroraConfig import load [as 別名]
def test_simple_config():
with temporary_file() as fp:
fp.write(MESOS_CONFIG)
fp.flush()
proxy_config1 = AuroraConfig.load(fp.name)
proxy_config2 = AuroraConfig.load(fp.name, name="hello_world")
assert proxy_config1.job()
assert proxy_config1._job == proxy_config2._job
assert proxy_config1._job == REIFIED_CONFIG
assert proxy_config1.name() == "hello_world"
assert proxy_config1.role() == "john_doe"
assert proxy_config1.cluster() == "smf1-test"
assert proxy_config1.ports() == set()
示例2: test_docker_binding_throws
# 需要導入模塊: from apache.aurora.config import AuroraConfig [as 別名]
# 或者: from apache.aurora.config.AuroraConfig import load [as 別名]
def test_docker_binding_throws(self, mock_resolve):
mock_resolve.side_effect = Exception('mock resolve failure')
binding_helper.unregister_all()
BindingHelper.register(DockerBindingHelper())
with temporary_file() as fp:
fp.write(DOCKER_BINDING_CONFIG)
fp.flush()
with CLUSTERS.patch(TEST_CLUSTERS):
cfg = AuroraConfig.load(fp.name)
with pytest.raises(Exception):
binding_helper.apply_all(cfg)
assert mock_resolve.mock_calls == [call(TEST_CLUSTER, 'some/name', 'some.tag')]
示例3: test_docker_binding
# 需要導入模塊: from apache.aurora.config import AuroraConfig [as 別名]
# 或者: from apache.aurora.config.AuroraConfig import load [as 別名]
def test_docker_binding(self, mock_resolve):
image_reference = 'registry.example.com/some/[email protected]:digest'
mock_resolve.return_value = image_reference
binding_helper.unregister_all()
BindingHelper.register(DockerBindingHelper())
with temporary_file() as fp:
fp.write(DOCKER_BINDING_CONFIG)
fp.flush()
with CLUSTERS.patch(TEST_CLUSTERS):
cfg = AuroraConfig.load(fp.name)
binding_helper.apply_all(cfg)
assert cfg.job().taskConfig.container.docker.image == image_reference
assert mock_resolve.mock_calls == [call(TEST_CLUSTER, 'some/name', 'some.tag')]
示例4: test_empty_config
# 需要導入模塊: from apache.aurora.config import AuroraConfig [as 別名]
# 或者: from apache.aurora.config.AuroraConfig import load [as 別名]
def test_empty_config():
with pytest.raises(AuroraConfig.InvalidConfig):
with temporary_file() as fp:
fp.write(UNDERSPECIFIED_MESOS_CONFIG)
fp.flush()
AuroraConfig.load(fp.name)
示例5: write_and_load_config
# 需要導入模塊: from apache.aurora.config import AuroraConfig [as 別名]
# 或者: from apache.aurora.config.AuroraConfig import load [as 別名]
def write_and_load_config(role):
with temporary_file() as fp:
fp.write(GENERIC_CONFIG)
fp.flush()
return AuroraConfig.load(fp.name, name='hello_world', select_role=role)