| # Copyright 2020 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| """Full test of cipd_upload module.""" |
| |
| from recipe_engine.config import List |
| from recipe_engine.recipe_api import Property |
| |
| DEPS = [ |
| 'fuchsia/status_check', |
| 'pigweed/cipd_upload', |
| 'recipe_engine/path', |
| 'recipe_engine/platform', |
| 'recipe_engine/properties', |
| ] |
| |
| PROPERTIES = { |
| 'add_platform': Property(kind=bool, default=True), |
| 'package_paths': Property(kind=List(str), default=()), |
| 'package_root': Property(kind=str, default=None), |
| 'path': Property(kind=str, default='foo/bar/baz'), |
| 'repository': Property( |
| kind=str, default='https://pigweed.googlesource.com/pigweed/pigweed' |
| ), |
| 'search_tag_key': Property(kind=str, default='key'), |
| 'search_tag_value': Property(kind=str, default='value'), |
| } |
| |
| PYTHON_VERSION_COMPATIBILITY = "PY3" |
| |
| |
| def RunSteps( |
| api, |
| add_platform, |
| package_paths, |
| package_root, |
| path, |
| repository, |
| search_tag_key, |
| search_tag_value, |
| ): # pylint: disable=invalid-name |
| """Run test steps.""" |
| |
| package_root = api.path['start_dir'].join(package_root or 'pkgroot') |
| |
| metadata = [('abc', '123')] |
| |
| api.cipd_upload( |
| add_platform=add_platform, |
| metadata=metadata, |
| paths=package_paths, |
| package_root=package_root, |
| cipd_path=path, |
| repository=repository, |
| search_tag={search_tag_key: search_tag_value}, |
| ) |
| |
| |
| def GenTests(api): # pylint: disable=invalid-name |
| """Define tests.""" |
| |
| yield ( |
| api.status_check.test('found') |
| + api.platform('linux', 64) |
| + api.cipd_upload.search_results('foo/bar/baz key:value', instances=1) |
| ) |
| |
| yield ( |
| api.status_check.test('upload') |
| + api.platform('linux', 64) |
| + api.cipd_upload.search_results('foo/bar/baz key:value', instances=0) |
| ) |
| |
| yield ( |
| api.status_check.test('extra_tags') |
| + api.properties(extra_tags={'abc': '123'}) |
| + api.platform('linux', 64) |
| + api.cipd_upload.search_results('foo/bar/baz key:value', instances=0) |
| ) |