Handle Swarm-style prefixed names in Container.from_ps()
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
edb6b24b8f
commit
cbd3ca07c4
3 changed files with 26 additions and 16 deletions
|
|
@ -20,7 +20,7 @@ class ContainerTest(unittest.TestCase):
|
|||
"Ports": None,
|
||||
"SizeRw": 0,
|
||||
"SizeRootFs": 0,
|
||||
"Names": ["/figtest_db_1"],
|
||||
"Names": ["/figtest_db_1", "/figtest_web_1/db"],
|
||||
"NetworkSettings": {
|
||||
"Ports": {},
|
||||
},
|
||||
|
|
@ -36,6 +36,18 @@ class ContainerTest(unittest.TestCase):
|
|||
"Name": "/figtest_db_1",
|
||||
})
|
||||
|
||||
def test_from_ps_prefixed(self):
|
||||
self.container_dict['Names'] = ['/swarm-host-1' + n for n in self.container_dict['Names']]
|
||||
|
||||
container = Container.from_ps(None,
|
||||
self.container_dict,
|
||||
has_been_inspected=True)
|
||||
self.assertEqual(container.dictionary, {
|
||||
"Id": "abc",
|
||||
"Image":"busybox:latest",
|
||||
"Name": "/figtest_db_1",
|
||||
})
|
||||
|
||||
def test_environment(self):
|
||||
container = Container(None, {
|
||||
'Id': 'abc',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue