mirror of https://github.com/docker/compose.git
Fix --timeout flag on restart, add tests for stop and restart
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
2cdde099fa
commit
2291fa2d45
|
@ -126,8 +126,8 @@ class Container(object):
|
||||||
def kill(self, **options):
|
def kill(self, **options):
|
||||||
return self.client.kill(self.id, **options)
|
return self.client.kill(self.id, **options)
|
||||||
|
|
||||||
def restart(self):
|
def restart(self, **options):
|
||||||
return self.client.restart(self.id)
|
return self.client.restart(self.id, **options)
|
||||||
|
|
||||||
def remove(self, **options):
|
def remove(self, **options):
|
||||||
return self.client.remove_container(self.id, **options)
|
return self.client.remove_container(self.id, **options)
|
||||||
|
|
|
@ -332,6 +332,17 @@ class CLITestCase(DockerClientTestCase):
|
||||||
self.command.dispatch(['rm', '-f'], None)
|
self.command.dispatch(['rm', '-f'], None)
|
||||||
self.assertEqual(len(service.containers(stopped=True)), 0)
|
self.assertEqual(len(service.containers(stopped=True)), 0)
|
||||||
|
|
||||||
|
def test_stop(self):
|
||||||
|
self.command.dispatch(['up', '-d'], None)
|
||||||
|
service = self.project.get_service('simple')
|
||||||
|
self.assertEqual(len(service.containers()), 1)
|
||||||
|
self.assertTrue(service.containers()[0].is_running)
|
||||||
|
|
||||||
|
self.command.dispatch(['stop', '-t', '1'], None)
|
||||||
|
|
||||||
|
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||||
|
self.assertFalse(service.containers(stopped=True)[0].is_running)
|
||||||
|
|
||||||
def test_kill(self):
|
def test_kill(self):
|
||||||
self.command.dispatch(['up', '-d'], None)
|
self.command.dispatch(['up', '-d'], None)
|
||||||
service = self.project.get_service('simple')
|
service = self.project.get_service('simple')
|
||||||
|
@ -371,7 +382,7 @@ class CLITestCase(DockerClientTestCase):
|
||||||
container = service.create_container()
|
container = service.create_container()
|
||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
started_at = container.dictionary['State']['StartedAt']
|
started_at = container.dictionary['State']['StartedAt']
|
||||||
self.command.dispatch(['restart'], None)
|
self.command.dispatch(['restart', '-t', '1'], None)
|
||||||
container.inspect()
|
container.inspect()
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
container.dictionary['State']['FinishedAt'],
|
container.dictionary['State']['FinishedAt'],
|
||||||
|
|
Loading…
Reference in New Issue