OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 """An end-to-end test for recipe module `cipd`. | 4 """An end-to-end test for recipe module `cipd`. |
5 | 5 |
6 This actually installs cipd client and runs commands against it through cipd | 6 This actually installs cipd client and runs commands against it through cipd |
7 recipe module. The test is end-to-end, which means that if cipd App Engine app | 7 recipe module. The test is end-to-end, which means that if cipd App Engine app |
8 is down, this will fail. | 8 is down, this will fail. |
9 """ | 9 """ |
10 | 10 |
11 DEPS = [ | 11 DEPS = [ |
12 'depot_tools/bot_update', | 12 'depot_tools/bot_update', |
13 'cipd', | 13 'cipd', |
14 'file', | 14 'file', |
15 'depot_tools/gclient', | 15 'depot_tools/gclient', |
16 'depot_tools/infra_paths', | |
17 'recipe_engine/json', | 16 'recipe_engine/json', |
18 'recipe_engine/path', | 17 'recipe_engine/path', |
19 'recipe_engine/platform', | 18 'recipe_engine/platform', |
20 'recipe_engine/properties', | 19 'recipe_engine/properties', |
21 'recipe_engine/python', | 20 'recipe_engine/python', |
22 'recipe_engine/raw_io', | 21 'recipe_engine/raw_io', |
23 'recipe_engine/step', | 22 'recipe_engine/step', |
24 'depot_tools/tryserver' | 23 'depot_tools/tryserver' |
25 ] | 24 ] |
26 | 25 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 allow_subannotations=True, | 69 allow_subannotations=True, |
71 ) | 70 ) |
72 | 71 |
73 | 72 |
74 def inner(api): | 73 def inner(api): |
75 """Actually performs the test in existing checkout.""" | 74 """Actually performs the test in existing checkout.""" |
76 api.cipd.install_client() | 75 api.cipd.install_client() |
77 assert api.cipd.get_executable() | 76 assert api.cipd.get_executable() |
78 | 77 |
79 test_package = '%s/%s' % (TEST_PACKAGE_PREFIX, api.cipd.platform_suffix()) | 78 test_package = '%s/%s' % (TEST_PACKAGE_PREFIX, api.cipd.platform_suffix()) |
80 test_package_file = api.infra_paths['slave_build'].join('test_package.cipd') | 79 test_package_file = api.path['slave_build'].join('test_package.cipd') |
81 step = api.cipd.build(api.properties['dir_to_package'], | 80 step = api.cipd.build(api.properties['dir_to_package'], |
82 test_package_file, | 81 test_package_file, |
83 test_package, install_mode='copy') | 82 test_package, install_mode='copy') |
84 package_pin = step.json.output['result'] | 83 package_pin = step.json.output['result'] |
85 instance_id = package_pin['instance_id'] | 84 instance_id = package_pin['instance_id'] |
86 assert package_pin['package'] == test_package | 85 assert package_pin['package'] == test_package |
87 step.presentation.step_text = 'instance_id: %s' % package_pin['instance_id'] | 86 step.presentation.step_text = 'instance_id: %s' % package_pin['instance_id'] |
88 | 87 |
89 # Path to a service account credentials to use to talk to CIPD backend. | 88 # Path to a service account credentials to use to talk to CIPD backend. |
90 # Deployed by Puppet. | 89 # Deployed by Puppet. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ) | 125 ) |
127 | 126 |
128 # Verify that tags are properly set. Note, there could be more tags! | 127 # Verify that tags are properly set. Note, there could be more tags! |
129 unset_tags = set('%s:%s' % i for i in tags.iteritems()) | 128 unset_tags = set('%s:%s' % i for i in tags.iteritems()) |
130 for tag_info in step.json.output['result']['tags']: | 129 for tag_info in step.json.output['result']['tags']: |
131 if tag_info['tag'] in unset_tags: | 130 if tag_info['tag'] in unset_tags: |
132 unset_tags.remove(tag_info['tag']) | 131 unset_tags.remove(tag_info['tag']) |
133 assert not unset_tags | 132 assert not unset_tags |
134 | 133 |
135 # Install test package we've just uploaded by ref. | 134 # Install test package we've just uploaded by ref. |
136 cipd_root = api.infra_paths['slave_build'].join('cipd_test_package') | 135 cipd_root = api.path['slave_build'].join('cipd_test_package') |
137 api.cipd.ensure(cipd_root, {test_package: 'latest'}) | 136 api.cipd.ensure(cipd_root, {test_package: 'latest'}) |
138 # Someone might have changed the latest ref in the meantime, | 137 # Someone might have changed the latest ref in the meantime, |
139 # so install again by exact instance_id. | 138 # so install again by exact instance_id. |
140 step = api.cipd.ensure(cipd_root, | 139 step = api.cipd.ensure(cipd_root, |
141 {test_package: package_pin['instance_id']}) | 140 {test_package: package_pin['instance_id']}) |
142 assert step.json.output['result'][0] == package_pin, ( | 141 assert step.json.output['result'][0] == package_pin, ( |
143 '\n%s\n!=\n%s\n' % (step.json.output['result'][0], package_pin)) | 142 '\n%s\n!=\n%s\n' % (step.json.output['result'][0], package_pin)) |
144 | 143 |
145 # Verify that we got same data back by building a new package from the | 144 # Verify that we got same data back by building a new package from the |
146 # installation folder and compare hashes. | 145 # installation folder and compare hashes. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ) | 184 ) |
186 ) | 185 ) |
187 yield ( | 186 yield ( |
188 api.test('cipd-latest-ok-outer-patch-rietveld') + | 187 api.test('cipd-latest-ok-outer-patch-rietveld') + |
189 api.properties.tryserver( | 188 api.properties.tryserver( |
190 mastername='chromium.infra', | 189 mastername='chromium.infra', |
191 buildername='cipd-module-tester', | 190 buildername='cipd-module-tester', |
192 patch_project='build', | 191 patch_project='build', |
193 ) | 192 ) |
194 ) | 193 ) |
OLD | NEW |