Ejemplo n.º 1
0
 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'])
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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!'))
Ejemplo n.º 4
0
 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!')
Ejemplo n.º 5
0
    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))