chromite changes for remoteexec builder support.
BUG=chromium:1256966
TEST=./run_tests
Change-Id: Id3f5494cb4603ba2974529e04ee3fdd341d432d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3259256
Tested-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/api/field_handler_unittest.py b/api/field_handler_unittest.py
index b91aaae..a9b9de1 100644
--- a/api/field_handler_unittest.py
+++ b/api/field_handler_unittest.py
@@ -12,6 +12,7 @@
from chromite.lib import chroot_lib
from chromite.lib import cros_test_lib
from chromite.lib import osutils
+from chromite.lib import remoteexec_util
class ChrootHandlerTest(cros_test_lib.TestCase):
@@ -73,6 +74,31 @@
self.assertEqual(empty_chroot, chroot)
+class HandleRemoteexec(cros_test_lib.TempDirTestCase):
+ """Tests for handling remoteexec."""
+
+ def test_handle_remoteexec(self):
+ """Test handling remoteexec when there is a RemoteexecConfig."""
+ reclient_dir = os.path.join(self.tempdir, 'cipd/rbe')
+ reproxy_cfg_file = os.path.join(self.tempdir,
+ 'reclient_cfgs/reproxy_config.cfg')
+
+ osutils.SafeMakedirs(reclient_dir)
+ osutils.Touch(reproxy_cfg_file, makedirs=True)
+ remoteexec_config = common_pb2.RemoteexecConfig(
+ reclient_dir=reclient_dir, reproxy_cfg_file=reproxy_cfg_file)
+ message = build_api_test_pb2.TestRequestMessage(
+ remoteexec_config=remoteexec_config)
+
+ expected = remoteexec_util.Remoteexec(reclient_dir, reproxy_cfg_file)
+ self.assertEqual(expected, field_handler.handle_remoteexec(message))
+
+ def test_handle_remoteexec_no_config(self):
+ """Test handling remoteexec when there is no RmoteexecConfig."""
+ message = build_api_test_pb2.TestRequestMessage()
+ self.assertIsNone(field_handler.handle_remoteexec(message))
+
+
class CopyPathInTest(cros_test_lib.TempDirTestCase):
"""PathHandler tests."""