'Given there are some stopped containers and scale is called with a
desired number that is the same as the number of stopped containers,
test that those containers are restarted and not removed/recreated.'

@pytest.mark.skipif(SWARM_SKIP_CONTAINERS_ALL, reason=u'Swarm    /containers/json    bug')
def test_scale_with_stopped_containers(self):

    service = self.create_service(u'web')
    next_number = service._next_container_number()
    valid_numbers = [next_number, (next_number + 1)]
    service.create_container(number=next_number)
    service.create_container(number=(next_number + 1))
    with mock.patch(u'sys.stderr', new_callable=StringIO) as mock_stderr:
        service.scale(2)
    for container in service.containers():
        self.assertTrue(container.is_running)
        self.assertTrue((container.number in valid_numbers))
    captured_output = mock_stderr.getvalue()
    self.assertNotIn(u'Creating', captured_output)
    self.assertIn(u'Starting', captured_output)
