go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/resultdb/proto/v1/predicate.proto (about)

     1  // Copyright 2019 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package luci.resultdb.v1;
    18  
    19  import "go.chromium.org/luci/resultdb/proto/v1/common.proto";
    20  
    21  option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb";
    22  
    23  // Represents a function TestResult -> bool.
    24  // Empty message matches all test results.
    25  //
    26  // Most clients would want to set expected_results to
    27  // VARIANTS_WITH_UNEXPECTED_RESULTS.
    28  message TestResultPredicate {
    29    // A test result must have a test id matching this regular expression
    30    // entirely, i.e. the expression is implicitly wrapped with ^ and $.
    31    string test_id_regexp = 1;
    32  
    33    // A test result must have a variant satisfying this predicate.
    34    VariantPredicate variant = 2;
    35  
    36    // Filters test results based on TestResult.expected field.
    37    enum Expectancy {
    38      // All test results satisfy this.
    39      // WARNING: using this significantly increases response size and latency.
    40      ALL = 0;
    41  
    42      // A test result must belong to a test variant that has one or more
    43      // unexpected results. It can be used to fetch both unexpected and flakily
    44      // expected results.
    45      //
    46      // Note that the predicate is defined at the test variant level.
    47      // For example, if a test variant expects a PASS and has results
    48      // [FAIL, FAIL, PASS], then all results satisfy the predicate because
    49      // the variant satisfies the predicate.
    50      VARIANTS_WITH_UNEXPECTED_RESULTS = 1;
    51  
    52      // Similar to VARIANTS_WITH_UNEXPECTED_RESULTS, but the test variant
    53      // must not have any expected results.
    54      VARIANTS_WITH_ONLY_UNEXPECTED_RESULTS = 2;
    55    }
    56  
    57    // A test result must match this predicate based on TestResult.expected field.
    58    // Most clients would want to override this field because the default
    59    // typically causes a large response size.
    60    Expectancy expectancy = 3;
    61  
    62    // If true, filter out exonerated test variants.
    63    // Mutually exclusive with Expectancy.ALL.
    64    //
    65    // If false, the filter is NOT applied.
    66    // That is, the test result may or may not be exonerated.
    67    bool exclude_exonerated = 4;
    68  }
    69  
    70  // Represents a function TestExoneration -> bool.
    71  // Empty message matches all test exonerations.
    72  message TestExonerationPredicate {
    73    // A test exoneration must have a test id matching this regular expression
    74    // entirely, i.e. the expression is implicitly wrapped with ^ and $.
    75    string test_id_regexp = 1;
    76  
    77    // A test exoneration must have a variant satisfying this predicate.
    78    VariantPredicate variant = 2;
    79  }
    80  
    81  // Represents a function Variant -> bool.
    82  message VariantPredicate {
    83    oneof predicate {
    84      // A variant must be equal this definition exactly.
    85      Variant equals = 1;
    86  
    87      // A variant's key-value pairs must contain those in this one.
    88      Variant contains = 2;
    89    }
    90  }
    91  
    92  // Represents a function Artifact -> bool.
    93  message ArtifactPredicate {
    94    // A set of Invocation's outgoing edge types.
    95    message EdgeTypeSet {
    96      // The edges represented by Invocation.included_invocations field.
    97      bool included_invocations = 1;
    98      // The parent-child relationship between Invocation and TestResult.
    99      bool test_results = 2;
   100    }
   101  
   102    // Specifies which edges to follow when retrieving directly/indirectly
   103    // included artifacts.
   104    // For example,
   105    // - to retrieve only invocation-level artifacts, use
   106    //   {included_invocations: true}.
   107    // - to retrieve only test-result-level artifacts, use {test_results: true}.
   108    //
   109    // By default, follows all edges.
   110    EdgeTypeSet follow_edges = 1; // defaults to All.
   111  
   112    // If an Artifact belongs to a TestResult, then the test result must satisfy
   113    // this predicate.
   114    // Note: this predicate does NOT apply to invocation-level artifacts.
   115    // To exclude them from the response, use follow_edges.
   116    TestResultPredicate test_result_predicate = 2;
   117  
   118    // An artifact must have a content type matching this regular expression
   119    // entirely, i.e. the expression is implicitly wrapped with ^ and $.
   120    // Defaults to ".*".
   121    string content_type_regexp = 3;
   122  
   123    // An artifact must have an ID matching this regular expression entirely, i.e.
   124    // the expression is implicitly wrapped with ^ and $.  Defaults to ".*".
   125    string artifact_id_regexp = 4;
   126  }
   127  
   128  
   129  // Represents a function TestMetadata -> bool.
   130  // Empty message matches all test metadata.
   131  message TestMetadataPredicate {
   132    // A test metadata must have the test id in this list.
   133    repeated string test_ids = 1;
   134  }