github.com/GoogleCloudPlatform/testgrid@v0.0.174/web/src/gen/pb/custom_evaluator/custom_evaluator.ts (about)

     1  // @generated by protobuf-ts 2.8.3 with parameter long_type_string
     2  // @generated from protobuf file "pb/custom_evaluator/custom_evaluator.proto" (package "testgrid.custom_evaluator", syntax proto3)
     3  // tslint:disable
     4  import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
     5  import type { IBinaryWriter } from "@protobuf-ts/runtime";
     6  import { WireType } from "@protobuf-ts/runtime";
     7  import type { BinaryReadOptions } from "@protobuf-ts/runtime";
     8  import type { IBinaryReader } from "@protobuf-ts/runtime";
     9  import { UnknownFieldHandler } from "@protobuf-ts/runtime";
    10  import type { PartialMessage } from "@protobuf-ts/runtime";
    11  import { reflectionMergePartial } from "@protobuf-ts/runtime";
    12  import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
    13  import { MessageType } from "@protobuf-ts/runtime";
    14  import { TestStatus } from "../test_status/test_status";
    15  // A configuration sub-object used to do custom evaluation of test results.
    16  
    17  /**
    18   * A collection of Rule objects. Used to define many rules.
    19   *
    20   * @generated from protobuf message testgrid.custom_evaluator.RuleSet
    21   */
    22  export interface RuleSet {
    23      /**
    24       * @generated from protobuf field: repeated testgrid.custom_evaluator.Rule rules = 1;
    25       */
    26      rules: Rule[];
    27  }
    28  /**
    29   * A single rule that describes how to evaluate a test_cases_pb2.TestResult
    30   *
    31   * @generated from protobuf message testgrid.custom_evaluator.Rule
    32   */
    33  export interface Rule {
    34      /**
    35       * Multiple comparisons to run against a result. EVERY TestResultComparison
    36       * has to succeed for this Rule to succeed.
    37       *
    38       * @generated from protobuf field: repeated testgrid.custom_evaluator.TestResultComparison test_result_comparisons = 1;
    39       */
    40      testResultComparisons: TestResultComparison[];
    41      /**
    42       * Required: The TestStatus to return if the comparison succeeds.
    43       *
    44       * @generated from protobuf field: testgrid.test_status.TestStatus computed_status = 3;
    45       */
    46      computedStatus: TestStatus;
    47  }
    48  /**
    49   * Describes how to get information the TestResult proto and how to compare the
    50   * value against the comparison value.
    51   *
    52   * @generated from protobuf message testgrid.custom_evaluator.TestResultComparison
    53   */
    54  export interface TestResultComparison {
    55      /**
    56       * Required: This is the comparison that will be used as
    57       *
    58       * @generated from protobuf field: testgrid.custom_evaluator.Comparison comparison = 1;
    59       */
    60      comparison?: Comparison;
    61      /**
    62       * @generated from protobuf oneof: test_result_info
    63       */
    64      testResultInfo: {
    65          oneofKind: "propertyKey";
    66          /**
    67           * The name of the property to evaluate.
    68           * Properties are usually strings, so a string comparison is assumed and
    69           * required.
    70           *
    71           * @generated from protobuf field: string property_key = 2;
    72           */
    73          propertyKey: string;
    74      } | {
    75          oneofKind: "testResultField";
    76          /**
    77           * This will find the scalar field with the given name within the TestResult
    78           * proto. The value of that field will be used to evaluate.
    79           *
    80           * Accepted junit values for junit results are:
    81           *   name: name of the test case
    82           *   error_count: 1 if the test case has an error message
    83           *   failure_count: 1 if the test case has a failure message
    84           *
    85           * NOTE: Only supported for string and numerical values.
    86           *
    87           * @generated from protobuf field: string test_result_field = 3;
    88           */
    89          testResultField: string;
    90      } | {
    91          oneofKind: "testResultErrorField";
    92          /**
    93           * This will find the field nested within the first error of the TestResult
    94           * proto. The value of that field will be used to evaluate.
    95           *
    96           * Accepted values for junit results are:
    97           *   exception_type: the failure and/or error message.
    98           *
    99           * NOTE: Only supported for string and numerical values
   100           *
   101           * @generated from protobuf field: string test_result_error_field = 4;
   102           */
   103          testResultErrorField: string;
   104      } | {
   105          oneofKind: "targetStatus";
   106          /**
   107           * This will enable the target status comparation. The value of the status
   108           * will be used to evaluate.
   109           *
   110           * @generated from protobuf field: bool target_status = 5;
   111           */
   112          targetStatus: boolean;
   113      } | {
   114          oneofKind: undefined;
   115      };
   116  }
   117  /**
   118   * The method of comparison used for evaluation. Describes how to compare two
   119   * values.
   120   *
   121   * @generated from protobuf message testgrid.custom_evaluator.Comparison
   122   */
   123  export interface Comparison {
   124      /**
   125       * Required: Defines how to compare two attributes.
   126       * When the TestResult value is numerical, numerical_value will be used to
   127       * compare. When the TestResult value is a string, string_value will be used.
   128       *
   129       * @generated from protobuf field: testgrid.custom_evaluator.Comparison.Operator op = 1;
   130       */
   131      op: Comparison_Operator;
   132      /**
   133       * @generated from protobuf oneof: comparison_value
   134       */
   135      comparisonValue: {
   136          oneofKind: "stringValue";
   137          /**
   138           * For operations EQ, NE, REGEX, STARTS_WITH, CONTAINS
   139           *
   140           * @generated from protobuf field: string string_value = 2;
   141           */
   142          stringValue: string;
   143      } | {
   144          oneofKind: "numericalValue";
   145          /**
   146           * For operations EQ, NE, LT, LE, GT, GE
   147           *
   148           * @generated from protobuf field: double numerical_value = 3;
   149           */
   150          numericalValue: number;
   151      } | {
   152          oneofKind: "targetStatusValue";
   153          /**
   154           * For operations EQ
   155           *
   156           * @generated from protobuf field: testgrid.test_status.TestStatus target_status_value = 4;
   157           */
   158          targetStatusValue: TestStatus;
   159      } | {
   160          oneofKind: undefined;
   161      };
   162  }
   163  /**
   164   * @generated from protobuf enum testgrid.custom_evaluator.Comparison.Operator
   165   */
   166  export enum Comparison_Operator {
   167      /**
   168       * Unknown. May assume OP_EQ for legacy purposes, but should warn.
   169       *
   170       * @generated from protobuf enum value: OP_UNKNOWN = 0;
   171       */
   172      OP_UNKNOWN = 0,
   173      /**
   174       * Equals operator.
   175       *
   176       * @generated from protobuf enum value: OP_EQ = 1;
   177       */
   178      OP_EQ = 1,
   179      /**
   180       * Not equals operator.
   181       *
   182       * @generated from protobuf enum value: OP_NE = 2;
   183       */
   184      OP_NE = 2,
   185      /**
   186       * Comparison value less than TestResult's value
   187       *
   188       * @generated from protobuf enum value: OP_LT = 3;
   189       */
   190      OP_LT = 3,
   191      /**
   192       * Comparison value less than or equal TestResult's value
   193       *
   194       * @generated from protobuf enum value: OP_LE = 4;
   195       */
   196      OP_LE = 4,
   197      /**
   198       * Comparison value greater than TestResult's value
   199       *
   200       * @generated from protobuf enum value: OP_GT = 5;
   201       */
   202      OP_GT = 5,
   203      /**
   204       * Comparison value greater than or equal TestResult's value
   205       *
   206       * @generated from protobuf enum value: OP_GE = 6;
   207       */
   208      OP_GE = 6,
   209      /**
   210       * Regex match of Comparison.value string with the TestResult's evaluation
   211       * value string.
   212       *
   213       * @generated from protobuf enum value: OP_REGEX = 7;
   214       */
   215      OP_REGEX = 7,
   216      /**
   217       * Checks to see if the evaluation value string starts with the
   218       * Comparison.value string
   219       *
   220       * @generated from protobuf enum value: OP_STARTS_WITH = 8;
   221       */
   222      OP_STARTS_WITH = 8,
   223      /**
   224       * Checks to see if the evaluation value string is contained within the
   225       * Comparison.value string
   226       *
   227       * @generated from protobuf enum value: OP_CONTAINS = 9;
   228       */
   229      OP_CONTAINS = 9
   230  }
   231  // @generated message type with reflection information, may provide speed optimized methods
   232  class RuleSet$Type extends MessageType<RuleSet> {
   233      constructor() {
   234          super("testgrid.custom_evaluator.RuleSet", [
   235              { no: 1, name: "rules", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Rule }
   236          ]);
   237      }
   238      create(value?: PartialMessage<RuleSet>): RuleSet {
   239          const message = { rules: [] };
   240          globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
   241          if (value !== undefined)
   242              reflectionMergePartial<RuleSet>(this, message, value);
   243          return message;
   244      }
   245      internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RuleSet): RuleSet {
   246          let message = target ?? this.create(), end = reader.pos + length;
   247          while (reader.pos < end) {
   248              let [fieldNo, wireType] = reader.tag();
   249              switch (fieldNo) {
   250                  case /* repeated testgrid.custom_evaluator.Rule rules */ 1:
   251                      message.rules.push(Rule.internalBinaryRead(reader, reader.uint32(), options));
   252                      break;
   253                  default:
   254                      let u = options.readUnknownField;
   255                      if (u === "throw")
   256                          throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
   257                      let d = reader.skip(wireType);
   258                      if (u !== false)
   259                          (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
   260              }
   261          }
   262          return message;
   263      }
   264      internalBinaryWrite(message: RuleSet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
   265          /* repeated testgrid.custom_evaluator.Rule rules = 1; */
   266          for (let i = 0; i < message.rules.length; i++)
   267              Rule.internalBinaryWrite(message.rules[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
   268          let u = options.writeUnknownFields;
   269          if (u !== false)
   270              (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
   271          return writer;
   272      }
   273  }
   274  /**
   275   * @generated MessageType for protobuf message testgrid.custom_evaluator.RuleSet
   276   */
   277  export const RuleSet = new RuleSet$Type();
   278  // @generated message type with reflection information, may provide speed optimized methods
   279  class Rule$Type extends MessageType<Rule> {
   280      constructor() {
   281          super("testgrid.custom_evaluator.Rule", [
   282              { no: 1, name: "test_result_comparisons", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => TestResultComparison },
   283              { no: 3, name: "computed_status", kind: "enum", T: () => ["testgrid.test_status.TestStatus", TestStatus] }
   284          ]);
   285      }
   286      create(value?: PartialMessage<Rule>): Rule {
   287          const message = { testResultComparisons: [], computedStatus: 0 };
   288          globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
   289          if (value !== undefined)
   290              reflectionMergePartial<Rule>(this, message, value);
   291          return message;
   292      }
   293      internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Rule): Rule {
   294          let message = target ?? this.create(), end = reader.pos + length;
   295          while (reader.pos < end) {
   296              let [fieldNo, wireType] = reader.tag();
   297              switch (fieldNo) {
   298                  case /* repeated testgrid.custom_evaluator.TestResultComparison test_result_comparisons */ 1:
   299                      message.testResultComparisons.push(TestResultComparison.internalBinaryRead(reader, reader.uint32(), options));
   300                      break;
   301                  case /* testgrid.test_status.TestStatus computed_status */ 3:
   302                      message.computedStatus = reader.int32();
   303                      break;
   304                  default:
   305                      let u = options.readUnknownField;
   306                      if (u === "throw")
   307                          throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
   308                      let d = reader.skip(wireType);
   309                      if (u !== false)
   310                          (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
   311              }
   312          }
   313          return message;
   314      }
   315      internalBinaryWrite(message: Rule, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
   316          /* repeated testgrid.custom_evaluator.TestResultComparison test_result_comparisons = 1; */
   317          for (let i = 0; i < message.testResultComparisons.length; i++)
   318              TestResultComparison.internalBinaryWrite(message.testResultComparisons[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
   319          /* testgrid.test_status.TestStatus computed_status = 3; */
   320          if (message.computedStatus !== 0)
   321              writer.tag(3, WireType.Varint).int32(message.computedStatus);
   322          let u = options.writeUnknownFields;
   323          if (u !== false)
   324              (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
   325          return writer;
   326      }
   327  }
   328  /**
   329   * @generated MessageType for protobuf message testgrid.custom_evaluator.Rule
   330   */
   331  export const Rule = new Rule$Type();
   332  // @generated message type with reflection information, may provide speed optimized methods
   333  class TestResultComparison$Type extends MessageType<TestResultComparison> {
   334      constructor() {
   335          super("testgrid.custom_evaluator.TestResultComparison", [
   336              { no: 1, name: "comparison", kind: "message", T: () => Comparison },
   337              { no: 2, name: "property_key", kind: "scalar", oneof: "testResultInfo", T: 9 /*ScalarType.STRING*/ },
   338              { no: 3, name: "test_result_field", kind: "scalar", oneof: "testResultInfo", T: 9 /*ScalarType.STRING*/ },
   339              { no: 4, name: "test_result_error_field", kind: "scalar", oneof: "testResultInfo", T: 9 /*ScalarType.STRING*/ },
   340              { no: 5, name: "target_status", kind: "scalar", oneof: "testResultInfo", T: 8 /*ScalarType.BOOL*/ }
   341          ]);
   342      }
   343      create(value?: PartialMessage<TestResultComparison>): TestResultComparison {
   344          const message = { testResultInfo: { oneofKind: undefined } };
   345          globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
   346          if (value !== undefined)
   347              reflectionMergePartial<TestResultComparison>(this, message, value);
   348          return message;
   349      }
   350      internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TestResultComparison): TestResultComparison {
   351          let message = target ?? this.create(), end = reader.pos + length;
   352          while (reader.pos < end) {
   353              let [fieldNo, wireType] = reader.tag();
   354              switch (fieldNo) {
   355                  case /* testgrid.custom_evaluator.Comparison comparison */ 1:
   356                      message.comparison = Comparison.internalBinaryRead(reader, reader.uint32(), options, message.comparison);
   357                      break;
   358                  case /* string property_key */ 2:
   359                      message.testResultInfo = {
   360                          oneofKind: "propertyKey",
   361                          propertyKey: reader.string()
   362                      };
   363                      break;
   364                  case /* string test_result_field */ 3:
   365                      message.testResultInfo = {
   366                          oneofKind: "testResultField",
   367                          testResultField: reader.string()
   368                      };
   369                      break;
   370                  case /* string test_result_error_field */ 4:
   371                      message.testResultInfo = {
   372                          oneofKind: "testResultErrorField",
   373                          testResultErrorField: reader.string()
   374                      };
   375                      break;
   376                  case /* bool target_status */ 5:
   377                      message.testResultInfo = {
   378                          oneofKind: "targetStatus",
   379                          targetStatus: reader.bool()
   380                      };
   381                      break;
   382                  default:
   383                      let u = options.readUnknownField;
   384                      if (u === "throw")
   385                          throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
   386                      let d = reader.skip(wireType);
   387                      if (u !== false)
   388                          (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
   389              }
   390          }
   391          return message;
   392      }
   393      internalBinaryWrite(message: TestResultComparison, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
   394          /* testgrid.custom_evaluator.Comparison comparison = 1; */
   395          if (message.comparison)
   396              Comparison.internalBinaryWrite(message.comparison, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
   397          /* string property_key = 2; */
   398          if (message.testResultInfo.oneofKind === "propertyKey")
   399              writer.tag(2, WireType.LengthDelimited).string(message.testResultInfo.propertyKey);
   400          /* string test_result_field = 3; */
   401          if (message.testResultInfo.oneofKind === "testResultField")
   402              writer.tag(3, WireType.LengthDelimited).string(message.testResultInfo.testResultField);
   403          /* string test_result_error_field = 4; */
   404          if (message.testResultInfo.oneofKind === "testResultErrorField")
   405              writer.tag(4, WireType.LengthDelimited).string(message.testResultInfo.testResultErrorField);
   406          /* bool target_status = 5; */
   407          if (message.testResultInfo.oneofKind === "targetStatus")
   408              writer.tag(5, WireType.Varint).bool(message.testResultInfo.targetStatus);
   409          let u = options.writeUnknownFields;
   410          if (u !== false)
   411              (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
   412          return writer;
   413      }
   414  }
   415  /**
   416   * @generated MessageType for protobuf message testgrid.custom_evaluator.TestResultComparison
   417   */
   418  export const TestResultComparison = new TestResultComparison$Type();
   419  // @generated message type with reflection information, may provide speed optimized methods
   420  class Comparison$Type extends MessageType<Comparison> {
   421      constructor() {
   422          super("testgrid.custom_evaluator.Comparison", [
   423              { no: 1, name: "op", kind: "enum", T: () => ["testgrid.custom_evaluator.Comparison.Operator", Comparison_Operator] },
   424              { no: 2, name: "string_value", kind: "scalar", oneof: "comparisonValue", T: 9 /*ScalarType.STRING*/ },
   425              { no: 3, name: "numerical_value", kind: "scalar", oneof: "comparisonValue", T: 1 /*ScalarType.DOUBLE*/ },
   426              { no: 4, name: "target_status_value", kind: "enum", oneof: "comparisonValue", T: () => ["testgrid.test_status.TestStatus", TestStatus] }
   427          ]);
   428      }
   429      create(value?: PartialMessage<Comparison>): Comparison {
   430          const message = { op: 0, comparisonValue: { oneofKind: undefined } };
   431          globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
   432          if (value !== undefined)
   433              reflectionMergePartial<Comparison>(this, message, value);
   434          return message;
   435      }
   436      internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Comparison): Comparison {
   437          let message = target ?? this.create(), end = reader.pos + length;
   438          while (reader.pos < end) {
   439              let [fieldNo, wireType] = reader.tag();
   440              switch (fieldNo) {
   441                  case /* testgrid.custom_evaluator.Comparison.Operator op */ 1:
   442                      message.op = reader.int32();
   443                      break;
   444                  case /* string string_value */ 2:
   445                      message.comparisonValue = {
   446                          oneofKind: "stringValue",
   447                          stringValue: reader.string()
   448                      };
   449                      break;
   450                  case /* double numerical_value */ 3:
   451                      message.comparisonValue = {
   452                          oneofKind: "numericalValue",
   453                          numericalValue: reader.double()
   454                      };
   455                      break;
   456                  case /* testgrid.test_status.TestStatus target_status_value */ 4:
   457                      message.comparisonValue = {
   458                          oneofKind: "targetStatusValue",
   459                          targetStatusValue: reader.int32()
   460                      };
   461                      break;
   462                  default:
   463                      let u = options.readUnknownField;
   464                      if (u === "throw")
   465                          throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
   466                      let d = reader.skip(wireType);
   467                      if (u !== false)
   468                          (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
   469              }
   470          }
   471          return message;
   472      }
   473      internalBinaryWrite(message: Comparison, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
   474          /* testgrid.custom_evaluator.Comparison.Operator op = 1; */
   475          if (message.op !== 0)
   476              writer.tag(1, WireType.Varint).int32(message.op);
   477          /* string string_value = 2; */
   478          if (message.comparisonValue.oneofKind === "stringValue")
   479              writer.tag(2, WireType.LengthDelimited).string(message.comparisonValue.stringValue);
   480          /* double numerical_value = 3; */
   481          if (message.comparisonValue.oneofKind === "numericalValue")
   482              writer.tag(3, WireType.Bit64).double(message.comparisonValue.numericalValue);
   483          /* testgrid.test_status.TestStatus target_status_value = 4; */
   484          if (message.comparisonValue.oneofKind === "targetStatusValue")
   485              writer.tag(4, WireType.Varint).int32(message.comparisonValue.targetStatusValue);
   486          let u = options.writeUnknownFields;
   487          if (u !== false)
   488              (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
   489          return writer;
   490      }
   491  }
   492  /**
   493   * @generated MessageType for protobuf message testgrid.custom_evaluator.Comparison
   494   */
   495  export const Comparison = new Comparison$Type();