blob: e2a3393e1b1ae3c1f7fde33065a6e4bc351bb6fa [file] [log] [blame]
# Copyright 2020 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.
"""Recipe for disabled tests, for use in test metrics dashboards
Traverses files looking for flags associated with disabled tests.
"""
from PB.recipes.fuchsia.disabled_tests import InputProperties
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"fuchsia/bqupload",
"fuchsia/checkout",
"fuchsia/status_check",
"recipe_engine/context",
"recipe_engine/json",
"recipe_engine/properties",
"recipe_engine/step",
"recipe_engine/time",
]
PROPERTIES = InputProperties
def RunSteps(api, props):
checkout_dir = api.checkout.with_options(
manifest=props.manifest,
remote=props.remote,
# No need to fetch CIPD packages, we only need to look at
# files and those are always checked into git.
fetch_packages=False,
)
with api.context(cwd=checkout_dir):
tests = api.step(
"find disabled tests",
[
api.resource("disabled_tests.py"),
api.json.output(),
],
step_test_data=lambda: api.json.test_api.output(
[
{"path": "src/foo/bar", "line_number": 100, "file_type": ".rs"},
{"path": "src/bar/foo", "line_number": 10, "file_type": ".cc"},
]
),
).json.output
date = str(api.time.utcnow().date()) # E.g. "2021-05-27".
bq_rows = []
for test in tests:
row = {"date_created": date}
row.update(test)
bq_rows.append(row)
if not props.dry_run:
api.bqupload.insert(
"upload to bigquery",
project="tq-resilience-data",
dataset="test_metrics",
table="disabled_tests",
rows=bq_rows,
)
def GenTests(api):
def properties(**kwargs):
props = {
"manifest": "fuchsia/flower",
"remote": "https://fuchsia.googlesource.com/integration",
}
props.update(kwargs)
return api.properties(**props)
yield api.status_check.test("basic") + properties()
yield api.status_check.test("dry_run") + properties(dry_run=True)