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)
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)
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)
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)
def tearDown(self): ContainerTestCase.tearDown(self) shutil.rmtree(self.tmpdir, ignore_errors=True)
def setUp(self): ContainerTestCase.setUp(self) self.path = os.path.dirname(__file__) self.tmpdir = tempfile.mkdtemp(prefix="udotcloud", suffix="tests")