| # Copyright 2024 The LUCI Authors. All rights reserved. |
| # Use of this source code is governed under the Apache License, Version 2.0 |
| # that can be found in the LICENSE file. |
| |
| from __future__ import annotations |
| |
| from PB.recipe_modules.recipe_engine.resultdb.examples import query_test_variants as query_test_variants_pb |
| from PB.go.chromium.org.luci.resultdb.proto.v1 import resultdb |
| from recipe_engine.post_process import DropExpectation |
| |
| DEPS = [ |
| 'resultdb', |
| 'recipe_engine/properties', |
| ] |
| |
| INLINE_PROPERTIES_PROTO = """ |
| message InputProperties { |
| string invocation = 1; |
| string test_variant_status = 2; |
| repeated string field_mask_paths = 3; |
| } |
| """ |
| |
| PROPERTIES = query_test_variants_pb.InputProperties |
| |
| |
| def RunSteps(api, props: query_test_variants_pb.InputProperties): |
| api.resultdb.query_test_variants( |
| [props.invocation], |
| test_variant_status=props.test_variant_status, |
| page_size=10, |
| field_mask_paths=props.field_mask_paths, |
| ) |
| |
| |
| def GenTests(api): |
| yield api.test( |
| 'basic', |
| api.properties( |
| query_test_variants_pb.InputProperties( |
| invocation='invocations/build-8761170341278523313')), |
| api.resultdb.query_test_variants(resultdb.QueryTestVariantsResponse()), |
| api.post_process(DropExpectation), |
| ) |
| yield api.test( |
| 'status_and_fields', |
| api.properties( |
| query_test_variants_pb.InputProperties( |
| invocation='invocations/build-8761170341278523313', |
| test_variant_status='UNEXPECTED', |
| field_mask_paths=['results', 'sources_id'], |
| )), |
| api.resultdb.query_test_variants(resultdb.QueryTestVariantsResponse()), |
| api.post_process(DropExpectation), |
| ) |