| 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', |
| 16 'recipe_engine/json', | 17 'recipe_engine/json', |
| 17 'recipe_engine/path', | 18 'recipe_engine/path', |
| 18 'recipe_engine/platform', | 19 'recipe_engine/platform', |
| 19 'recipe_engine/properties', | 20 'recipe_engine/properties', |
| 20 'recipe_engine/python', | 21 'recipe_engine/python', |
| 21 'recipe_engine/raw_io', | 22 'recipe_engine/raw_io', |
| 22 'recipe_engine/step', | 23 'recipe_engine/step', |
| 23 'depot_tools/tryserver' | 24 'depot_tools/tryserver' |
| 24 ] | 25 ] |
| 25 | 26 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 allow_subannotations=True, | 70 allow_subannotations=True, |
| 70 ) | 71 ) |
| 71 | 72 |
| 72 | 73 |
| 73 def inner(api): | 74 def inner(api): |
| 74 """Actually performs the test in existing checkout.""" | 75 """Actually performs the test in existing checkout.""" |
| 75 api.cipd.install_client() | 76 api.cipd.install_client() |
| 76 assert api.cipd.get_executable() | 77 assert api.cipd.get_executable() |
| 77 | 78 |
| 78 test_package = '%s/%s' % (TEST_PACKAGE_PREFIX, api.cipd.platform_suffix()) | 79 test_package = '%s/%s' % (TEST_PACKAGE_PREFIX, api.cipd.platform_suffix()) |
| 79 test_package_file = api.path['slave_build'].join('test_package.cipd') | 80 test_package_file = api.infra_paths['slave_build'].join('test_package.cipd') |
| 80 step = api.cipd.build(api.properties['dir_to_package'], | 81 step = api.cipd.build(api.properties['dir_to_package'], |
| 81 test_package_file, | 82 test_package_file, |
| 82 test_package, install_mode='copy') | 83 test_package, install_mode='copy') |
| 83 package_pin = step.json.output['result'] | 84 package_pin = step.json.output['result'] |
| 84 instance_id = package_pin['instance_id'] | 85 instance_id = package_pin['instance_id'] |
| 85 assert package_pin['package'] == test_package | 86 assert package_pin['package'] == test_package |
| 86 step.presentation.step_text = 'instance_id: %s' % package_pin['instance_id'] | 87 step.presentation.step_text = 'instance_id: %s' % package_pin['instance_id'] |
| 87 | 88 |
| 88 # Path to a service account credentials to use to talk to CIPD backend. | 89 # Path to a service account credentials to use to talk to CIPD backend. |
| 89 # Deployed by Puppet. | 90 # Deployed by Puppet. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ) | 126 ) |
| 126 | 127 |
| 127 # Verify that tags are properly set. Note, there could be more tags! | 128 # Verify that tags are properly set. Note, there could be more tags! |
| 128 unset_tags = set('%s:%s' % i for i in tags.iteritems()) | 129 unset_tags = set('%s:%s' % i for i in tags.iteritems()) |
| 129 for tag_info in step.json.output['result']['tags']: | 130 for tag_info in step.json.output['result']['tags']: |
| 130 if tag_info['tag'] in unset_tags: | 131 if tag_info['tag'] in unset_tags: |
| 131 unset_tags.remove(tag_info['tag']) | 132 unset_tags.remove(tag_info['tag']) |
| 132 assert not unset_tags | 133 assert not unset_tags |
| 133 | 134 |
| 134 # Install test package we've just uploaded by ref. | 135 # Install test package we've just uploaded by ref. |
| 135 cipd_root = api.path['slave_build'].join('cipd_test_package') | 136 cipd_root = api.infra_paths['slave_build'].join('cipd_test_package') |
| 136 api.cipd.ensure(cipd_root, {test_package: 'latest'}) | 137 api.cipd.ensure(cipd_root, {test_package: 'latest'}) |
| 137 # Someone might have changed the latest ref in the meantime, | 138 # Someone might have changed the latest ref in the meantime, |
| 138 # so install again by exact instance_id. | 139 # so install again by exact instance_id. |
| 139 step = api.cipd.ensure(cipd_root, | 140 step = api.cipd.ensure(cipd_root, |
| 140 {test_package: package_pin['instance_id']}) | 141 {test_package: package_pin['instance_id']}) |
| 141 assert step.json.output['result'][0] == package_pin, ( | 142 assert step.json.output['result'][0] == package_pin, ( |
| 142 '\n%s\n!=\n%s\n' % (step.json.output['result'][0], package_pin)) | 143 '\n%s\n!=\n%s\n' % (step.json.output['result'][0], package_pin)) |
| 143 | 144 |
| 144 # Verify that we got same data back by building a new package from the | 145 # Verify that we got same data back by building a new package from the |
| 145 # installation folder and compare hashes. | 146 # installation folder and compare hashes. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ) | 185 ) |
| 185 ) | 186 ) |
| 186 yield ( | 187 yield ( |
| 187 api.test('cipd-latest-ok-outer-patch-rietveld') + | 188 api.test('cipd-latest-ok-outer-patch-rietveld') + |
| 188 api.properties.tryserver( | 189 api.properties.tryserver( |
| 189 mastername='chromium.infra', | 190 mastername='chromium.infra', |
| 190 buildername='cipd-module-tester', | 191 buildername='cipd-module-tester', |
| 191 patch_project='build', | 192 patch_project='build', |
| 192 ) | 193 ) |
| 193 ) | 194 ) |
| OLD | NEW |