blob: 3204e756faae87512434b211569ae5fd6416308e [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
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,
)
date = str(api.time.utcnow().date()) # E.g. "2021-05-27".
with api.context(cwd=checkout_dir):
tests = api.step(
"find disabled tests",
[
api.resource("find_disabled_tests.py"),
api.json.output(),
],
step_test_data=lambda: api.json.test_api.output(
[
{
"path": "src/foo/bar",
"line_number": 100,
"bug": "12345",
"compiled": False,
"date_discovered": date,
},
]
),
).json.output
bq_rows = []
for test in tests:
bq_rows.append(test)
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)