示例#1
0
 def test_custom_application_build(self):
     application = Application(os.path.join(self.path, "custom_app"), {})
     images = application.build(
         base_image=Image(ImageRevSpec.parse("lopter/sandbox-base:latest")))
     self.assertIsInstance(images, dict)
     result = images.get("db")
     self.assertIsNotNone(result)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()))
     with _destroy_result(container):
         with container.run(["ls", "/tmp/code/"]):
             pass
         self.assertIn("dotcloud.yml", container.logs)
         self.assertIn("buildscript-stamp", container.logs)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()))
     with _destroy_result(container):
         with container.run(["ls", "-R", "/usr/bin"]):
             pass
         self.assertIn("cmake", container.logs)
示例#2
0
 def test_simple_application_build(self):
     application = Application(os.path.join(self.path, "simple_gunicorn_gevent_app"), {})
     images = application.build(base_image=Image(ImageRevSpec.parse("lopter/sandbox-base:latest")))
     self.assertIsInstance(images, dict)
     result = images.get("api")
     self.assertIsNotNone(result)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()
     ))
     with _destroy_result(container):
         with container.run(["ls", "/home/dotcloud/current"]):
             pass
         self.assertIn("dotcloud.yml", container.logs)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()
     ))
     with _destroy_result(container):
         with container.run(["stat", "-c", "%u", "/home/dotcloud/code"]):
             pass
         self.assertIn("1000", container.logs)
示例#3
0
 def test_simple_application_build(self):
     application = Application(
         os.path.join(self.path, "simple_gunicorn_gevent_app"), {})
     images = application.build(
         base_image=Image(ImageRevSpec.parse("lopter/sandbox-base:latest")))
     self.assertIsInstance(images, dict)
     result = images.get("api")
     self.assertIsNotNone(result)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()))
     with _destroy_result(container):
         with container.run(["ls", "/home/dotcloud/current"]):
             pass
         self.assertIn("dotcloud.yml", container.logs)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()))
     with _destroy_result(container):
         with container.run(["stat", "-c", "%u", "/home/dotcloud/code"]):
             pass
         self.assertIn("1000", container.logs)
示例#4
0
 def test_custom_application_build(self):
     application = Application(os.path.join(self.path, "custom_app"), {})
     images = application.build(base_image=Image(ImageRevSpec.parse("lopter/sandbox-base:latest")))
     self.assertIsInstance(images, dict)
     result = images.get("db")
     self.assertIsNotNone(result)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()
     ))
     with _destroy_result(container):
         with container.run(["ls", "/tmp/code/"]):
             pass
         self.assertIn("dotcloud.yml", container.logs)
         self.assertIn("buildscript-stamp", container.logs)
     container = result.instantiate(commit_as=ImageRevSpec.parse(
         ContainerTestCase.random_image_name()
     ))
     with _destroy_result(container):
         with container.run(["ls", "-R", "/usr/bin"]):
             pass
         self.assertIn("cmake", container.logs)
示例#5
0
 def tearDown(self):
     ContainerTestCase.tearDown(self)
     shutil.rmtree(self.tmpdir, ignore_errors=True)
示例#6
0
 def setUp(self):
     ContainerTestCase.setUp(self)
     self.path = os.path.dirname(__file__)
     self.tmpdir = tempfile.mkdtemp(prefix="udotcloud", suffix="tests")
示例#7
0
 def tearDown(self):
     ContainerTestCase.tearDown(self)
     shutil.rmtree(self.tmpdir, ignore_errors=True)
示例#8
0
 def setUp(self):
     ContainerTestCase.setUp(self)
     self.path = os.path.dirname(__file__)
     self.tmpdir = tempfile.mkdtemp(prefix="udotcloud", suffix="tests")