mirror of https://github.com/docker/docker-py.git
types: add missing log type enums
See https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerCreate. Closes #2849. Signed-off-by: Milas Bowman <milas.bowman@docker.com> Co-authored-by: Marty Berryman <mberryman@sewerai.com>
This commit is contained in:
parent
26753c81de
commit
eaa6ffaa46
|
@ -15,9 +15,12 @@ class LogConfigTypesEnum:
|
||||||
'journald',
|
'journald',
|
||||||
'gelf',
|
'gelf',
|
||||||
'fluentd',
|
'fluentd',
|
||||||
|
'awslogs',
|
||||||
|
'splunk',
|
||||||
|
'etwlogs',
|
||||||
'none'
|
'none'
|
||||||
)
|
)
|
||||||
JSON, SYSLOG, JOURNALD, GELF, FLUENTD, NONE = _values
|
JSON, SYSLOG, JOURNALD, GELF, FLUENTD, AWS, SPLUNK, ETW, NONE = _values
|
||||||
|
|
||||||
|
|
||||||
class LogConfig(DictType):
|
class LogConfig(DictType):
|
||||||
|
|
|
@ -262,9 +262,13 @@ class UlimitTest(unittest.TestCase):
|
||||||
Ulimit(name='hello', hard='456')
|
Ulimit(name='hello', hard='456')
|
||||||
|
|
||||||
|
|
||||||
class LogConfigTest(unittest.TestCase):
|
@pytest.mark.parametrize(
|
||||||
def test_create_host_config_dict_logconfig(self):
|
"log_config_type",
|
||||||
dct = {'type': LogConfig.types.SYSLOG, 'config': {'key1': 'val1'}}
|
[LogConfig.types.SYSLOG, LogConfig.types.AWS]
|
||||||
|
)
|
||||||
|
class LogConfigTest:
|
||||||
|
def test_create_host_config_dict_logconfig(self, log_config_type):
|
||||||
|
dct = {'type': log_config_type, 'config': {'key1': 'val1'}}
|
||||||
config = create_host_config(
|
config = create_host_config(
|
||||||
version=DEFAULT_DOCKER_API_VERSION, log_config=dct
|
version=DEFAULT_DOCKER_API_VERSION, log_config=dct
|
||||||
)
|
)
|
||||||
|
@ -272,8 +276,8 @@ class LogConfigTest(unittest.TestCase):
|
||||||
assert isinstance(config['LogConfig'], LogConfig)
|
assert isinstance(config['LogConfig'], LogConfig)
|
||||||
assert dct['type'] == config['LogConfig'].type
|
assert dct['type'] == config['LogConfig'].type
|
||||||
|
|
||||||
def test_create_host_config_obj_logconfig(self):
|
def test_create_host_config_obj_logconfig(self, log_config_type):
|
||||||
obj = LogConfig(type=LogConfig.types.SYSLOG, config={'key1': 'val1'})
|
obj = LogConfig(type=log_config_type, config={'key1': 'val1'})
|
||||||
config = create_host_config(
|
config = create_host_config(
|
||||||
version=DEFAULT_DOCKER_API_VERSION, log_config=obj
|
version=DEFAULT_DOCKER_API_VERSION, log_config=obj
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue