def _EndToEndIntegrationTest(self, tgt_image, src_image, sign): """Helper test function for validating end to end payload generation.""" output_uri = os.path.join(self.tempdir, 'expected_payload_out') output_metadata_uri = output_uri + '.metadata-signature' output_metadata_json = output_uri + '.json' payload = gspaths.Payload(tgt_image=tgt_image, src_image=src_image, uri=output_uri) paygen_payload_lib.CreateAndUploadPayload(payload=payload, sign=sign) self.assertExists(output_uri) self.assertEqual(os.path.exists(output_metadata_uri), sign) self.assertExists(output_metadata_json)
def _EndToEndIntegrationTest(self, tgt_image, src_image, sign): """Helper test function for validating end to end payload generation.""" output_uri = os.path.join(self.tempdir, 'expected_payload_out') output_metadata_uri = output_uri + '.metadata-signature' output_metadata_json = output_uri + '.json' payload = gspaths.Payload(tgt_image=tgt_image, src_image=src_image, uri=output_uri) paygen_payload_lib.CreateAndUploadPayload( payload=payload, cache=self.cache, work_dir=self.tempdir, au_generator_uri=gspaths.ChromeosReleases.GeneratorUri( payload.tgt_image.channel, payload.tgt_image.board, '7587.0.0'), sign=sign) self.assertTrue(os.path.exists(output_uri)) self.assertEqual(os.path.exists(output_metadata_uri), sign) self.assertTrue(os.path.exists(output_metadata_json))
def _GenerateSinglePayload(payload, work_dir, sign, dry_run): """Generate a single payload. This is intended to be safe to call inside a new process. Args: payload: gspath.Payload object defining the payloads to generate. work_dir: Working directory for payload generation. sign: boolean to decide if payload should be signed. dry_run: boolean saying if this is a dry run. """ # This cache dir will be shared with other processes, but we need our # own instance of the cache manager to properly coordinate. cache_dir = paygen_payload_lib.FindCacheDir() with download_cache.DownloadCache( cache_dir, cache_size=PaygenBuild.CACHE_SIZE) as cache: # Actually generate the payload. paygen_payload_lib.CreateAndUploadPayload(payload, cache, work_dir=work_dir, sign=sign, dry_run=dry_run)