本文整理汇总了Python中compose.Service._get_container_create_options方法的典型用法代码示例。如果您正苦于以下问题:Python Service._get_container_create_options方法的具体用法?Python Service._get_container_create_options怎么用?Python Service._get_container_create_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类compose.Service
的用法示例。
在下文中一共展示了Service._get_container_create_options方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_split_domainname_fqdn
# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_container_create_options [as 别名]
def test_split_domainname_fqdn(self):
service = Service('foo',
hostname='name.domain.tld',
client=self.mock_client)
self.mock_client.containers.return_value = []
opts = service._get_container_create_options({'image': 'foo'})
self.assertEqual(opts['hostname'], 'name', 'hostname')
self.assertEqual(opts['domainname'], 'domain.tld', 'domainname')
示例2: test_env_from_multiple_files
# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_container_create_options [as 别名]
def test_env_from_multiple_files(self):
service = Service('foo',
env_file=['tests/fixtures/env/one.env', 'tests/fixtures/env/two.env'],
client=self.mock_client,
image='image_name',
)
options = service._get_container_create_options({})
self.assertEqual(
options['environment'],
{'ONE': '2', 'TWO': '1', 'THREE': '3', 'FOO': 'baz', 'DOO': 'dah'}
)
示例3: test_parse_environment
# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_container_create_options [as 别名]
def test_parse_environment(self):
service = Service('foo',
environment=['NORMAL=F1', 'CONTAINS_EQUALS=F=2', 'TRAILING_EQUALS='],
client=self.mock_client,
image='image_name',
)
options = service._get_container_create_options({})
self.assertEqual(
options['environment'],
{'NORMAL': 'F1', 'CONTAINS_EQUALS': 'F=2', 'TRAILING_EQUALS': ''}
)
示例4: test_resolve_environment_from_file
# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_container_create_options [as 别名]
def test_resolve_environment_from_file(self):
os.environ['FILE_DEF'] = 'E1'
os.environ['FILE_DEF_EMPTY'] = 'E2'
os.environ['ENV_DEF'] = 'E3'
service = Service('foo',
env_file=['tests/fixtures/env/resolve.env'],
client=self.mock_client,
image='image_name',
)
options = service._get_container_create_options({})
self.assertEqual(
options['environment'],
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''}
)