Allow rich results from uprev_android
uprev_android used to return a single value: the revved Android atom
from cros_mark_android_as_stable stdout. To allow uprev_android to
return richer information in the future, in this CL we
- make cros_mark_android_as_stable print a JSON instead
- make uprev_android return a custom result object
This is needed to implement the PUpr uprev handler for Android packages.
We need cros_mark_android_as_stable to pass the list of changed files.
BUG=b:187792081
TEST=./run_tests
Change-Id: I8e3d9fa5fe110dbd614c356ed14544d148afba35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3299971
Tested-by: Shao-Chuan Lee <shaochuan@chromium.org>
Reviewed-by: Jaques Clapauch <jaquesc@google.com>
Commit-Queue: Shao-Chuan Lee <shaochuan@chromium.org>
diff --git a/api/controller/android_unittest.py b/api/controller/android_unittest.py
index 8e28f62..8da0dcc 100644
--- a/api/controller/android_unittest.py
+++ b/api/controller/android_unittest.py
@@ -130,7 +130,9 @@
def testCallsCommandCorrectly(self):
"""Test that commands.MarkAndroidAsStable is called correctly."""
- self.uprev.return_value = 'cat/android-1.2.3'
+ self.uprev.return_value = packages.UprevAndroidResult(
+ revved=True,
+ android_atom='cat/android-1.2.3')
atom = common_pb2.PackageInfo()
atom.category = 'cat'
atom.package_name = 'android'
@@ -150,7 +152,7 @@
def testHandlesEarlyExit(self):
"""Test that early exit is handled correctly."""
- self.uprev.return_value = ''
+ self.uprev.return_value = packages.UprevAndroidResult(revved=False)
android.MarkStable(self.input_proto, self.response, self.api_config)
self.uprev.assert_called_once_with(
android_package=self.input_proto.package_name,