| Index: appengine/swarming/server/task_request_test.py
|
| diff --git a/appengine/swarming/server/task_request_test.py b/appengine/swarming/server/task_request_test.py
|
| index 73032b0b350c032e32065eb962d1091afdd926aa..361c5ce43b52c8279b7bdb3e8c04d15fa402a788 100755
|
| --- a/appengine/swarming/server/task_request_test.py
|
| +++ b/appengine/swarming/server/task_request_test.py
|
| @@ -638,6 +638,70 @@ class TaskRequestApiTest(TestCase):
|
| ndb.Key(task_request.TaskRequest, 0x7f14acec2fcfffff),
|
| task_request.request_id_to_key(0xeb5313d0300000))
|
|
|
| + def test_packages_grouped_by_path(self):
|
| + def cp(name, vers, path):
|
| + return task_request.CipdPackage(
|
| + package_name=name, version=vers, path=path)
|
| +
|
| + deadbeef = 'deadbeef' * 5
|
| + badc0fee = 'badc0fee' * 5
|
| +
|
| + ci = task_request.CipdInput(packages=[
|
| + cp('unpinned/${platform}', 'latest', 'a'),
|
| + cp('partial/windows-amd64', 'latest', 'b'),
|
| + cp('fully_specified/windows', deadbeef, 'b'),
|
| + ])
|
| +
|
| + self.assertEqual(
|
| + ci.packages_grouped_by_path(None),
|
| + [
|
| + (
|
| + "a",
|
| + [
|
| + task_request.PinInfo(
|
| + pkg=cp('unpinned/${platform}', 'latest', 'a'), pin=None),
|
| + ]
|
| + ),
|
| + (
|
| + "b",
|
| + [
|
| + task_request.PinInfo(
|
| + pkg=cp('fully_specified/windows', deadbeef, 'b'), pin=None),
|
| + task_request.PinInfo(
|
| + pkg=cp('partial/windows-amd64', 'latest', 'b'), pin=None),
|
| + ]
|
| + )
|
| + ]
|
| + )
|
| +
|
| + self.assertEqual(
|
| + ci.packages_grouped_by_path([
|
| + cp('unpinned/windows', 'instance_id1', 'a'),
|
| + cp('partial/windows-amd64', badc0fee, 'b'),
|
| + cp('fully_specified/windows', deadbeef, 'b'),
|
| + ]),
|
| + [
|
| + (
|
| + "a",
|
| + [
|
| + task_request.PinInfo(
|
| + pkg=cp('unpinned/${platform}', 'latest', 'a'),
|
| + pin=cp('unpinned/windows', 'instance_id1', 'a')),
|
| + ]
|
| + ),
|
| + (
|
| + "b",
|
| + [
|
| + task_request.PinInfo(
|
| + pkg=cp('fully_specified/windows', deadbeef, 'b'), pin=None),
|
| + task_request.PinInfo(
|
| + pkg=cp('partial/windows-amd64', 'latest', 'b'),
|
| + pin=cp(None, badc0fee, 'b')),
|
| + ]
|
| + )
|
| + ]
|
| + )
|
| +
|
|
|
| if __name__ == '__main__':
|
| if '-v' in sys.argv:
|
|
|