blob: d44a130fb775bf78f8691a106b70369ac44a05d1 [file]
# Copyright 2024 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 abandon_old_changes module."""
from __future__ import annotations
from collections.abc import Iterator
from recipe_engine import post_process, recipe_api, recipe_test_api
DEPS = [
'fuchsia/buildbucket_util',
'pigweed/abandon_old_changes',
]
def RunSteps(api: recipe_api.RecipeScriptApi):
api.abandon_old_changes(host='pigweed')
def GenTests(api) -> Iterator[recipe_test_api.TestData]:
yield api.buildbucket_util.test(
'success',
api.post_check(
post_process.MustRun,
'abandon old changes.pigweed.abandon 1001',
),
api.post_check(
post_process.MustRun,
'abandon old changes.pigweed.abandon 1002',
),
api.post_check(
post_process.MustRun,
'abandon old changes.pigweed.success',
),
api.post_check(
post_process.DoesNotRun,
'abandon old changes.pigweed.failure',
),
api.post_process(post_process.DropExpectation),
)
yield api.buildbucket_util.test(
'failure',
api.override_step_data(
'abandon old changes.pigweed.get old changes',
retcode=1,
),
api.post_check(
post_process.DoesNotRun,
'abandon old changes.pigweed.success',
),
api.post_check(
post_process.MustRun,
'abandon old changes.pigweed.failure',
),
api.post_process(post_process.DropExpectation),
)