Start, restart, pause and unpause exit with non-zero if nothing to do
Signed-off-by: Dimitar Bonev <dimitar.bonev@gmail.com>
This commit is contained in:
parent
5b32d32b2d
commit
bc843d6758
4 changed files with 46 additions and 9 deletions
|
|
@ -664,6 +664,10 @@ class CLITestCase(DockerClientTestCase):
|
|||
self.assertEqual(len(service.containers(stopped=True)), 1)
|
||||
self.assertFalse(service.containers(stopped=True)[0].is_running)
|
||||
|
||||
def test_start_no_containers(self):
|
||||
result = self.dispatch(['start'], returncode=1)
|
||||
assert 'No containers to start' in result.stderr
|
||||
|
||||
def test_pause_unpause(self):
|
||||
self.dispatch(['up', '-d'], None)
|
||||
service = self.project.get_service('simple')
|
||||
|
|
@ -675,6 +679,14 @@ class CLITestCase(DockerClientTestCase):
|
|||
self.dispatch(['unpause'], None)
|
||||
self.assertFalse(service.containers()[0].is_paused)
|
||||
|
||||
def test_pause_no_containers(self):
|
||||
result = self.dispatch(['pause'], returncode=1)
|
||||
assert 'No containers to pause' in result.stderr
|
||||
|
||||
def test_unpause_no_containers(self):
|
||||
result = self.dispatch(['unpause'], returncode=1)
|
||||
assert 'No containers to unpause' in result.stderr
|
||||
|
||||
def test_logs_invalid_service_name(self):
|
||||
self.dispatch(['logs', 'madeupname'], returncode=1)
|
||||
|
||||
|
|
@ -737,6 +749,10 @@ class CLITestCase(DockerClientTestCase):
|
|||
self.dispatch(['restart', '-t', '1'], None)
|
||||
self.assertEqual(len(service.containers(stopped=False)), 1)
|
||||
|
||||
def test_restart_no_containers(self):
|
||||
result = self.dispatch(['restart'], returncode=1)
|
||||
assert 'No containers to restart' in result.stderr
|
||||
|
||||
def test_scale(self):
|
||||
project = self.project
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue