Merge pull request #1108 from aanand/fix-deps-tests

Fix Project.up() tests
This commit is contained in:
Ben Firshman 2015-03-13 16:38:25 +00:00
commit dfc729b8f2
1 changed files with 15 additions and 22 deletions

View File

@ -264,20 +264,19 @@ class ProjectTest(DockerClientTestCase):
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
}, },
'net' : { 'data' : {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"] 'command': ["/bin/sleep", "300"]
}, },
'app': { 'db': {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
'net': 'container:net' 'volumes_from': ['data'],
}, },
'web': { 'web': {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
'net': 'container:net', 'links': ['db'],
'links': ['app']
}, },
}, },
client=self.client, client=self.client,
@ -288,8 +287,8 @@ class ProjectTest(DockerClientTestCase):
project.up(['web']) project.up(['web'])
self.assertEqual(len(project.containers()), 3) self.assertEqual(len(project.containers()), 3)
self.assertEqual(len(project.get_service('web').containers()), 1) self.assertEqual(len(project.get_service('web').containers()), 1)
self.assertEqual(len(project.get_service('app').containers()), 1) self.assertEqual(len(project.get_service('db').containers()), 1)
self.assertEqual(len(project.get_service('net').containers()), 1) self.assertEqual(len(project.get_service('data').containers()), 1)
self.assertEqual(len(project.get_service('console').containers()), 0) self.assertEqual(len(project.get_service('console').containers()), 0)
project.kill() project.kill()
@ -303,26 +302,19 @@ class ProjectTest(DockerClientTestCase):
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
}, },
'net' : { 'data' : {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"] 'command': ["/bin/sleep", "300"]
}, },
'vol': { 'db': {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
'volumes': ["/tmp"] 'volumes_from': ['data'],
},
'app': {
'image': 'busybox:latest',
'command': ["/bin/sleep", "300"],
'net': 'container:net'
}, },
'web': { 'web': {
'image': 'busybox:latest', 'image': 'busybox:latest',
'command': ["/bin/sleep", "300"], 'command': ["/bin/sleep", "300"],
'net': 'container:net', 'links': ['db'],
'links': ['app'],
'volumes_from': ['vol']
}, },
}, },
client=self.client, client=self.client,
@ -330,11 +322,12 @@ class ProjectTest(DockerClientTestCase):
project.start() project.start()
self.assertEqual(len(project.containers()), 0) self.assertEqual(len(project.containers()), 0)
project.up(['web'], start_deps=False) project.up(['db'], start_deps=False)
self.assertEqual(len(project.containers(stopped=True)), 2) self.assertEqual(len(project.containers(stopped=True)), 2)
self.assertEqual(len(project.get_service('web').containers()), 1) self.assertEqual(len(project.get_service('web').containers()), 0)
self.assertEqual(len(project.get_service('vol').containers(stopped=True)), 1) self.assertEqual(len(project.get_service('db').containers()), 1)
self.assertEqual(len(project.get_service('net').containers()), 0) self.assertEqual(len(project.get_service('data').containers()), 0)
self.assertEqual(len(project.get_service('data').containers(stopped=True)), 1)
self.assertEqual(len(project.get_service('console').containers()), 0) self.assertEqual(len(project.get_service('console').containers()), 0)
project.kill() project.kill()