blob: 59225dc8a3e6414ff9e36b48afe6ca0a7f986232 [file] [log] [blame]
# Copyright 2023 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 environment module."""
from typing import Generator
import dataclasses
from typing import Optional
from PB.recipe_modules.pigweed.bazel.tests.full import InputProperties
from recipe_engine import config_types, post_process, recipe_test_api
DEPS = [
'pigweed/bazel',
'recipe_engine/path',
]
PROPERTIES = InputProperties
@dataclasses.dataclass
class _FakeCheckoutContext:
root: config_types.Path
def RunSteps(api, props): # pylint: disable=invalid-name
# pylint: disable=missing-function-docstring
runner = api.bazel.new_runner(
checkout=_FakeCheckoutContext(api.path.start_dir),
options=props.bazel_options,
)
runner.run()
# Coverage only.
runner.ensure()
def GenTests(api) -> Generator[recipe_test_api.TestData, None, None]:
yield api.test(
'cipd',
api.bazel.properties(cipd_json_path='bazel.json'),
api.post_process(post_process.MustRun, 'ensure bazel'),
api.post_process(post_process.DoesNotRun, 'ensure bazelisk'),
api.post_process(post_process.DropExpectation),
)
yield api.test(
'bazelisk-fixed',
api.bazel.properties(bazelisk_version='1.19.0'),
api.post_process(post_process.MustRun, 'ensure bazelisk'),
api.post_process(post_process.DoesNotRun, 'ensure bazel'),
api.post_process(post_process.DropExpectation),
)
yield api.test(
'bazelisk-latest',
api.bazel.properties(),
api.post_process(post_process.MustRun, 'ensure bazelisk'),
api.post_process(post_process.DoesNotRun, 'ensure bazel'),
api.post_process(post_process.DropExpectation),
)