// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

package chromiumos.test.api;

option go_package = "go.chromium.org/chromiumos/config/go/test/api";

import "google/protobuf/any.proto";
import "chromiumos/test/api/test_case_result.proto";
import "chromiumos/test/api/test_execution_metadata.proto";
import "chromiumos/test/api/test_suite.proto";
import "chromiumos/test/lab/api/dut.proto";
import "chromiumos/test/lab/api/ip_endpoint.proto";

// CrosTestRequest specifies test suites, DUTs and other test-related
// information to run tests.
message CrosTestRequest {
  message Device {
    // DUT information.
    chromiumos.test.lab.api.Dut dut = 1;
    // DUT Server address.
    chromiumos.test.lab.api.IpEndpoint dut_server = 2;
    // Provision server address.
    chromiumos.test.lab.api.IpEndpoint provision_server = 3;
    // TestLibs server address.
    chromiumos.test.lab.api.IpEndpoint libs_server = 4;
    // Devboard server address.
    chromiumos.test.lab.api.IpEndpoint devboard_server = 5;
    // LSNexus server address.
    chromiumos.test.lab.api.IpEndpoint lsnexus_server = 6;
  }
  // Test suites to run (by tag or explicit list of tests)
  repeated TestSuite test_suites = 1;
  // Primary DUT
  Device primary = 2;
  // A list of companion hosts to be used for running tests.
  repeated Device companions = 3;
  // Inventory Server address.
  chromiumos.test.lab.api.IpEndpoint inventory_server = 4;
  // Test harness specific metadata
  google.protobuf.Any metadata = 5;
  // Generic args which will be directly passed to the harness. The driver is
  // responsible for handling them
  repeated Arg args = 6;

  // Publish server address.
  repeated PublishServer publish_servers = 7;
  // Timeout of the parent runner, to be handled by drivers for exiting early to
  // allow time to publish results.
  string timeout = 8;
}

message PublishServer {
  string name = 1;
  chromiumos.test.lab.api.IpEndpoint address = 2;
}

message CrosTestResponse {
  repeated TestCaseResult test_case_results = 1;
  google.protobuf.Any metadata = 2;
  repeated GivenTestResult given_test_results = 3;

  // useful when 1 given TC results in many child results
  message GivenTestResult {
    string parent_test = 1;
    repeated TestCaseResult child_test_case_results = 2;
  }
}
