api.payload: Have GeneratePayload return paths
We should have this endpoint tell us where it placed the artifacts it
generated. We'll constrain this to the local delta path as well as the
remote path if it was configured to upload.
In the future we might consider changing lib/paygen to give us a
complete listing of generated files, as some files here still escape
(i.e. are placed on gs but not returned). These include hashes and other
control files.
BUG=chromium:1122854
TEST=./run_tests.py
Change-Id: I2ba07c222980493b67b3dd22cfa3b0e87a699ed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2535713
Reviewed-by: LaMont Jones <lamontjones@chromium.org>
Commit-Queue: George Engelbrecht <engeg@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
diff --git a/api/controller/payload_unittest.py b/api/controller/payload_unittest.py
index 3d06849..9b8c0cd 100644
--- a/api/controller/payload_unittest.py
+++ b/api/controller/payload_unittest.py
@@ -17,7 +17,7 @@
class PayloadApiTests(cros_test_lib.MockTestCase, api_config.ApiConfigMixin):
- """Unittests for SetBinhost."""
+ """Unittests for PayloadApi."""
def setUp(self):
self.response = payload_pb2.GenerationResponse()
@@ -44,7 +44,10 @@
keyset='update_signer',
dryrun=False)
- self.result = payload_pb2.GenerationResponse()
+ self.result = payload_pb2.GenerationResponse(
+ success=True,
+ local_path='/tmp/aohiwdadoi/delta.bin',
+ remote_uri='gs://something')
def testValidateOnly(self):
"""Sanity check that a validate only call does not execute any logic."""
@@ -56,7 +59,8 @@
def testCallSucceeds(self):
"""Check that a call is made successfully."""
# Deep patch the paygen lib, this is a full run through service as well.
- self.PatchObject(paygen_payload_lib, 'PaygenPayload')
+ patch_obj = self.PatchObject(paygen_payload_lib, 'PaygenPayload')
+ patch_obj.return_value.Run.return_value = 'gs://something'
res = payload.GeneratePayload(self.req, self.result, self.api_config)
self.assertEqual(res, controller.RETURN_CODE_SUCCESS)