Make environment variables without a value the same as docker-cli.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
bcd5286cd3
commit
9d7dbe3857
7 changed files with 28 additions and 12 deletions
|
|
@ -138,9 +138,10 @@ class CLITestCase(unittest.TestCase):
|
|||
})
|
||||
|
||||
_, _, call_kwargs = mock_client.create_container.mock_calls[0]
|
||||
self.assertEqual(
|
||||
call_kwargs['environment'],
|
||||
{'FOO': 'ONE', 'BAR': 'NEW', 'OTHER': u'bär'})
|
||||
assert (
|
||||
sorted(call_kwargs['environment']) ==
|
||||
sorted(['FOO=ONE', 'BAR=NEW', 'OTHER=bär'])
|
||||
)
|
||||
|
||||
def test_run_service_with_restart_always(self):
|
||||
command = TopLevelCommand()
|
||||
|
|
|
|||
|
|
@ -1975,7 +1975,7 @@ class EnvTest(unittest.TestCase):
|
|||
}
|
||||
self.assertEqual(
|
||||
resolve_environment(service_dict),
|
||||
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': ''},
|
||||
{'FILE_DEF': 'F1', 'FILE_DEF_EMPTY': '', 'ENV_DEF': 'E3', 'NO_DEF': None},
|
||||
)
|
||||
|
||||
def test_resolve_environment_from_env_file(self):
|
||||
|
|
@ -2016,7 +2016,7 @@ class EnvTest(unittest.TestCase):
|
|||
'FILE_DEF': u'bär',
|
||||
'FILE_DEF_EMPTY': '',
|
||||
'ENV_DEF': 'E3',
|
||||
'NO_DEF': ''
|
||||
'NO_DEF': None
|
||||
},
|
||||
)
|
||||
|
||||
|
|
@ -2035,7 +2035,7 @@ class EnvTest(unittest.TestCase):
|
|||
}
|
||||
self.assertEqual(
|
||||
resolve_build_args(build),
|
||||
{'arg1': 'value1', 'empty_arg': '', 'env_arg': 'value2', 'no_env': ''},
|
||||
{'arg1': 'value1', 'empty_arg': '', 'env_arg': 'value2', 'no_env': None},
|
||||
)
|
||||
|
||||
@pytest.mark.xfail(IS_WINDOWS_PLATFORM, reason='paths use slash')
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class ServiceTest(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
opts['labels'][LABEL_CONFIG_HASH],
|
||||
'f8bfa1058ad1f4231372a0b1639f0dfdb574dafff4e8d7938049ae993f7cf1fc')
|
||||
assert opts['environment'] == {'also': 'real'}
|
||||
assert opts['environment'] == ['also=real']
|
||||
|
||||
def test_get_container_create_options_sets_affinity_with_binds(self):
|
||||
service = Service(
|
||||
|
|
@ -298,7 +298,7 @@ class ServiceTest(unittest.TestCase):
|
|||
1,
|
||||
previous_container=prev_container)
|
||||
|
||||
assert opts['environment'] == {'affinity:container': '=ababab'}
|
||||
assert opts['environment'] == ['affinity:container==ababab']
|
||||
|
||||
def test_get_container_create_options_no_affinity_without_binds(self):
|
||||
service = Service('foo', image='foo', client=self.mock_client)
|
||||
|
|
@ -312,7 +312,7 @@ class ServiceTest(unittest.TestCase):
|
|||
{},
|
||||
1,
|
||||
previous_container=prev_container)
|
||||
assert opts['environment'] == {}
|
||||
assert opts['environment'] == []
|
||||
|
||||
def test_get_container_not_found(self):
|
||||
self.mock_client.containers.return_value = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue