def test_start_container(self): docker.create_container(self._container) self.assertIsNotNone(docker.inspect_container(self._container)) docker.start_container(self._container) stat = docker.inspect_container(self._container) self.assertIsNotNone(stat) self.assertTrue(stat['State']['Running'])
def test_create_container(self): docker.create_container(self._container, force=False) self.assertIsNotNone(docker.inspect_container(self._container)) self.assertRaises( Exception, lambda: docker.create_container(self._container, force=False)) self.assertIsNotNone(docker.inspect_container(self._container))
def test_container_exec_error(self): docker.create_container(self._container) self.assertIsNotNone(docker.inspect_container(self._container)) self.assertRaises( Exception, lambda: docker.exec_cmd(self._container, 'echo hello!')) docker.delete_container(self._container) self.assertIsNone(docker.inspect_container(self._container)) self.assertRaises( Exception, lambda: docker.exec_cmd(self._container, 'echo hello!'))
def test_container_exec(self): docker.create_container(self._container) self.assertIsNotNone(docker.inspect_container(self._container)) docker.start_container(self._container) docker.exec_cmd(self._container, 'echo hello!')
def test_container_delete(self): docker.create_container(self._container) self.assertIsNotNone(docker.inspect_container(self._container)) docker.delete_container(self._container) self.assertIsNone(docker.inspect_container(self._container))