def setUp(self): self._tmpdir = tempfile.mkdtemp() self.cache = test_util.MockHybridRegistry( 'fake.gcr.io/google-appengine', self._tmpdir) self.ctx = context.Memory() self.ctx.AddFile("app.js", _APP) self.test_case = BuilderTestCase(builder.Node, self.ctx, self.cache, self.base_image)
def setUp(self, mock_from): mock_from.return_value.__enter__.return_value = None self.ctx = context.Memory() self.ctx.AddFile("app.py", _APP) args = mock.Mock() args.name = 'gcr.io/test/test:latest' args.base = 'gcr.io/google-appengine/python:latest' args.python_version = 'python2.7' args.tar_base_image_path = None self.builder = builder.Python(self.ctx, args, "") self.interpreter_builder = layer_builder.InterpreterLayerBuilder( self.builder._venv_dir, self.builder._args.python_version) self.builder._pip_install = mock.Mock()
def setUp(self, mock_from): mock_from.return_value.__enter__.return_value = None self._tmpdir = tempfile.mkdtemp() self.ctx = context.Memory() self.ctx.AddFile("app.php", _APP) args = mock.Mock() args.name = 'gcr.io/test/test:latest' args.base = 'gcr.io/google-appengine/php:latest' args.tar_base_image_path = None self.builder = builder.PHP(self.ctx, args) self.layer_builder = layer_builder.PhaseOneLayerBuilder( self.builder._ctx, self.builder._descriptor_files, "/app") # Mock out the calls to package managers for speed. self.layer_builder._gen_composer_install_tar = mock.Mock() self.layer_builder._gen_composer_install_tar.return_value = ('layer', 'sha')
def setUp(self, mock_from): mock_from.return_value.__enter__.return_value = None self._tmpdir = tempfile.mkdtemp() self.ctx = context.Memory() self.ctx.AddFile("app.js", _APP) args = mock.Mock() args.name = 'gcr.io/test/test:latest' args.base = 'gcr.io/google-appengine/python:latest' args.tar_base_image_path = None self.builder = builder.Node(self.ctx, args, "") self.layer_builder = layer_builder.LayerBuilder( ctx=self.builder._ctx, descriptor_files=self.builder._descriptor_files, destination_path="/app") # Mock out the calls to package managers for speed. self.layer_builder._gen_npm_install_tar = mock.Mock() self.layer_builder._gen_npm_install_tar.return_value = ('layer', 'sha')
def setUp(self, mock_from): mock_from.return_value.__enter__.return_value = None self.ctx = context.Memory() self.ctx.AddFile("app.py", _APP) args = mock.Mock() args.name = 'gcr.io/test/test:latest' args.base = 'gcr.io/google-appengine/python:latest' args.python_cmd = 'python2.7' args.pip_cmd = 'pip' args.venv_cmd = 'virtualenv' args.tar_base_image_path = None self.builder = builder.Python(self.ctx, args) # constants.VENV_DIR.replace('/', '') is used as the default path # will give permissions errors in some build environments (eg: kokoro) self.interpreter_builder = layer_builder.InterpreterLayerBuilder( ftl_util.gen_tmp_dir(constants.VENV_DIR.replace('/', '')), self.builder._python_cmd, self.builder._venv_cmd) self.interpreter_builder._setup_venv = mock.Mock() self.builder._pip_download_wheels = mock.Mock()