blob: 60b496c52f893f71930169864674e6156cbfac2d [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine.recipe_api import Property
DEPS = [
'fuchsia/release',
'fuchsia/status_check',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/raw_io',
]
PROPERTIES = {
'ref': Property(kind=str, help='Git ref to search release versions on.'),
'date': Property(kind=str, help='Release date as YYYYMMDD.'),
}
def RunSteps(api, ref, date):
repo_path = api.path.mkdtemp()
api.release.ref_to_release_version(ref=ref, repo_path=repo_path)
api.release.get_initial_release_version(date=date)
api.release.get_next_release_version(ref=ref, date=date, repo_path=repo_path)
api.release.get_next_candidate_version(ref=ref, repo_path=repo_path)
api.release.get_next_candidate_version(
ref=ref, add_track=True, repo_path=repo_path)
api.release.get_release_versions(ref=ref, date=date, repo_path=repo_path)
api.release.shorten_revision(revision=ref)
def GenTests(api):
test_tags = [
'releases/0.20191019.1.2', 'releases/0.20191019.1.1',
'releases/0.20191019.0.1'
'releases/0.20191018.0.1', 'releases/0.20191017.1.10',
'not_a_release_version', 'releases/0.20191017.1.9'
]
yield (api.test('basic') + api.properties(date='20191019', ref='foo') +
api.step_data('git describe',
api.raw_io.stream_output('releases/0.20191019.1.1')) +
api.step_data('get release versions on foo.git --no-pager',
api.raw_io.stream_output('\n'.join(test_tags))) +
api.step_data('get release versions on foo (2).git --no-pager',
api.raw_io.stream_output('\n'.join(test_tags))) +
api.step_data('get release versions on foo (3).git --no-pager',
api.raw_io.stream_output('\n'.join(test_tags))) +
api.step_data('get release versions on foo (4).git --no-pager',
api.raw_io.stream_output('\n'.join(test_tags))) +
api.status_check.status('success'))
yield (api.test('no_release_versions') +
api.properties(date='20191019', ref='foo') +
api.step_data('git describe',
api.raw_io.stream_output('releases/0.20191019.1.1')) +
api.step_data('get release versions on foo.git --no-pager',
api.raw_io.stream_output('')) +
api.status_check.status('failure'))
yield (api.test('not_a_release_version') +
api.properties(date='20191019', ref='foo') +
api.step_data('git describe',
api.raw_io.stream_output('not_a_release_version')) +
api.status_check.status('failure'))