mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add unit test for comparing containers with the same env vars
This commit is contained in:
parent
cf7cb4beeb
commit
fc26ae8ea3
1 changed files with 29 additions and 0 deletions
|
@ -840,6 +840,35 @@ class DockerTestCase(TestCase, LoaderModuleMockMixin):
|
|||
ret = docker_mod.compare_container('container1', 'container2')
|
||||
self.assertEqual(ret, {})
|
||||
|
||||
def test_compare_container_env_order(self):
|
||||
'''
|
||||
Test comparing two containers when the order of the Env HostConfig
|
||||
values are different, but the values are the same.
|
||||
'''
|
||||
def _inspect_container_effect(id_):
|
||||
return {
|
||||
'container1': {'Config': {},
|
||||
'HostConfig': {
|
||||
'Env': [
|
||||
'FOO=bar',
|
||||
'HELLO=world',
|
||||
]
|
||||
}},
|
||||
'container2': {'Config': {},
|
||||
'HostConfig': {
|
||||
'Env': [
|
||||
'HELLO=world',
|
||||
'FOO=bar',
|
||||
]
|
||||
}},
|
||||
}[id_]
|
||||
|
||||
inspect_container_mock = MagicMock(side_effect=_inspect_container_effect)
|
||||
|
||||
with patch.object(docker_mod, 'inspect_container', inspect_container_mock):
|
||||
ret = docker_mod.compare_container('container1', 'container2')
|
||||
self.assertEqual(ret, {})
|
||||
|
||||
def test_resolve_tag(self):
|
||||
'''
|
||||
Test the resolve_tag function. It runs docker.insect_image on the image
|
||||
|
|
Loading…
Add table
Reference in a new issue