Unset env vars behavior in 'run' mirroring engine

Unset env vars passed to `run` via command line options take the
value of the system's var with the same name.

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-04-22 14:45:51 -07:00 committed by Aanand Prasad
commit 5d244ef6d8
3 changed files with 23 additions and 1 deletions

View file

@ -1216,6 +1216,14 @@ class CLITestCase(DockerClientTestCase):
'simplecomposefile_simple_run_1',
'exited'))
@mock.patch.dict(os.environ)
def test_run_env_values_from_system(self):
os.environ['FOO'] = 'bar'
os.environ['BAR'] = 'baz'
result = self.dispatch(['run', '-e', 'FOO', 'simple', 'env'], None)
assert 'FOO=bar' in result.stdout
assert 'BAR=baz' not in result.stdout
def test_rm(self):
service = self.project.get_service('simple')
service.create_container()