blob: 1f8431c9e12f383b60691b66274800d2f2bd137d [file] [log] [blame]
# Copyright 2022 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 pipeline module."""
from recipe_engine import post_process
DEPS = [
'fuchsia/status_check',
'pigweed/pipeline',
'recipe_engine/step',
]
def RunSteps(api):
if not api.pipeline.in_pipeline:
api.step('not in pipeline', None)
return
api.step('in pipeline', None)
api.step(f'round {api.pipeline.round}', None)
prev_builds = api.pipeline.builds_from_previous_iteration
api.step(f'{len(prev_builds)} previous builds', None)
for build in prev_builds:
api.step(f'previous build {build}', None)
def GenTests(api): # pylint: disable=invalid-name
def ran(x):
return api.post_process(post_process.MustRun, x)
yield (api.status_check.test('nopipeline') + ran('not in pipeline'))
yield (
api.status_check.test('round_0')
+ api.pipeline.props(0, [])
+ ran('in pipeline')
+ ran('round 0')
+ ran('0 previous builds')
)
yield (
api.status_check.test('round_1')
+ api.pipeline.props(1, [123])
+ ran('in pipeline')
+ ran('round 1')
+ ran('1 previous builds')
+ ran('previous build 123')
)
yield (
api.status_check.test('round_4')
+ api.pipeline.props(4, [123, 456, 789])
+ ran('in pipeline')
+ ran('round 4')
+ ran('3 previous builds')
+ ran('previous build 123')
+ ran('previous build 456')
+ ran('previous build 789')
)
yield api.status_check.test('empty')