本文整理匯總了Python中atomicapp.nulecule.base.Nulecule.load_components方法的典型用法代碼示例。如果您正苦於以下問題:Python Nulecule.load_components方法的具體用法?Python Nulecule.load_components怎麽用?Python Nulecule.load_components使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類atomicapp.nulecule.base.Nulecule
的用法示例。
在下文中一共展示了Nulecule.load_components方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_load_components
# 需要導入模塊: from atomicapp.nulecule.base import Nulecule [as 別名]
# 或者: from atomicapp.nulecule.base.Nulecule import load_components [as 別名]
def test_load_components(self, MockNuleculeComponent):
graph = [
{
'name': 'app1',
'source': 'docker://somecontainer',
'params': []
},
{
'name': 'app2',
'artifacts': [
{'a': 'b'}
]
}
]
config = Config(answers={})
n = Nulecule('some-id', '0.0.2', graph, 'some/path', config=config)
n.load_components()
MockNuleculeComponent.assert_any_call(
graph[0]['name'], n.basepath, 'somecontainer',
graph[0]['params'], None, config)
MockNuleculeComponent.assert_any_call(
graph[1]['name'], n.basepath, None,
graph[1].get('params'), graph[1].get('artifacts'), config)
示例2: test_load_config_without_default_provider
# 需要導入模塊: from atomicapp.nulecule.base import Nulecule [as 別名]
# 或者: from atomicapp.nulecule.base.Nulecule import load_components [as 別名]
def test_load_config_without_default_provider(self):
"""
Test Nulecule load_config without specifying a default provider.
"""
config = Config()
params = [
{
"name": "key1",
"default": "val1",
},
{
"name": "key3",
"default": "val3"
}
]
graph = [
{
"name": "component1",
"params": [
{
"name": "key1",
},
{
"name": "key2",
"default": "val2"
}
],
"artifacts": []
}
]
n = Nulecule(id='some-id', specversion='0.0.2', metadata={},
graph=graph, params=params, basepath='some/path',
config=config)
n.load_components()
n.load_config()
self.assertEqual(n.config.runtime_answers(), {
'general': {
'namespace': 'default',
'provider': 'kubernetes',
'key1': 'val1',
'key3': 'val3'
},
'component1': {
'key2': 'val2'
}
})
self.assertEqual(
n.components[0].config.context(n.components[0].namespace),
{'key3': 'val3',
'key2': 'val2',
'key1': 'val1',
'namespace': 'default',
'provider': 'kubernetes'}
)
示例3: test_load_components
# 需要導入模塊: from atomicapp.nulecule.base import Nulecule [as 別名]
# 或者: from atomicapp.nulecule.base.Nulecule import load_components [as 別名]
def test_load_components(self, MockNuleculeComponent):
graph = [
{"name": "app1", "source": "docker://somecontainer", "params": []},
{"name": "app2", "artifacts": [{"a": "b"}]},
]
n = Nulecule("some-id", "0.0.2", graph, "some/path", {})
n.load_components()
MockNuleculeComponent.assert_any_call(
graph[0]["name"], n.basepath, "somecontainer", graph[0]["params"], None, {}
)
MockNuleculeComponent.assert_any_call(
graph[1]["name"], n.basepath, None, graph[1].get("params"), graph[1].get("artifacts"), {}
)
示例4: test_load_config_with_default_provider_overridden_by_answers
# 需要導入模塊: from atomicapp.nulecule.base import Nulecule [as 別名]
# 或者: from atomicapp.nulecule.base.Nulecule import load_components [as 別名]
def test_load_config_with_default_provider_overridden_by_answers(self):
"""
Test Nulecule load_config with default provider overridden by provider
in answers.
"""
config = Config(answers={
'general': {
'provider': 'openshift'
}
})
params = [
{
"name": "key1",
"default": "val1",
},
{
"name": "key3",
"default": "val3"
},
{
"name": "provider",
"default": "docker"
}
]
graph = [
{
"name": "component1",
"params": [
{
"name": "key1",
},
{
"name": "key2",
"default": "val2"
}
],
"artifacts": []
}
]
n = Nulecule(id='some-id', specversion='0.0.2', metadata={},
graph=graph, params=params, basepath='some/path',
config=config)
n.load_components()
n.load_config(config)
self.assertEqual(n.config.runtime_answers(), {
'general': {
'namespace': 'default',
'provider': 'openshift',
'key1': 'val1',
'key3': 'val3'
},
'component1': {
'key2': 'val2'
}
})
self.assertEqual(
n.components[0].config.context(n.components[0].namespace),
{'key3': 'val3',
'key2': 'val2',
'key1': 'val1',
'namespace': 'default',
'provider': 'openshift'}
)