• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto3";
6
7package chromiumos.test.api;
8
9option go_package = "go.chromium.org/chromiumos/config/go/test/api";
10
11import "google/protobuf/any.proto";
12import "google/protobuf/timestamp.proto";
13import "chromiumos/build/api/container_metadata.proto";
14import "chromiumos/test/api/cros_tool_runner_container_service_templates.proto";
15import "chromiumos/test/api/provision.proto";
16import "chromiumos/test/api/cros_publish_service.proto";
17import "chromiumos/test/api/cros_test_cli.proto";
18import "chromiumos/test/api/test_suite.proto";
19import "chromiumos/test/api/post_test_service.proto";
20import "chromiumos/test/api/generic_service.proto";
21import "chromiumos/test/lab/api/ip_endpoint.proto";
22import "chromiumos/test/lab/api/dut.proto";
23
24// CrosTestRunnerDynamicRequest is an input to CrosTestRunner that
25// provides greater flexibility in regards to the variability
26// and order by which test runner tasks are executed.
27//
28// next number = 5;
29message CrosTestRunnerDynamicRequest {
30  oneof start_request {
31    BuildMode build = 1;
32    // TODO(cdelagarza): Add ServerMode as a start_request option to
33    // once the CrosTestRunnerService is shifted towards using the dynamic
34    // trv2 request path.
35  }
36
37  message Task {
38    // List of containers to run for this task.
39    // ie container for cros-dut, then for cros-provision.
40    repeated ContainerRequest ordered_container_requests = 1;
41    oneof task {
42      ProvisionTask provision = 2;
43      PreTestTask pre_test = 3;
44      TestTask test = 4;
45      PostTestTask post_test = 5;
46      PublishTask publish = 6;
47      GenericTask generic = 8;
48    }
49    bool required = 7;
50  }
51
52  CrosTestRunnerParams params = 3;
53  repeated Task ordered_tasks = 4;
54}
55
56// Common parameters to include when sending a CrosTestRunnerDynamicRequest
57message CrosTestRunnerParams {
58  repeated TestSuite test_suites = 1;
59  // Container metadata to be used in test execution.
60  chromiumos.build.api.ContainerMetadata container_metadata = 2;
61  // Keyvals are (key, value) pairs
62  map<string, string> keyvals = 3;
63  // Key to grab container info.
64  string container_metadata_key = 4;
65  // Board and model of the primary dut.
66  chromiumos.test.lab.api.DutModel primary_dut = 5;
67  // Boards and models of the companion duts.
68  repeated chromiumos.test.lab.api.DutModel companion_duts = 6;
69  // Deadline of the execution.
70  google.protobuf.Timestamp deadline = 7;
71}
72
73// BuildMode provides the necessary parameters by which
74// test execution using a build may be achieved.
75message BuildMode {
76  // The buildbucket ID of the CTP build that sent this test_runner request.
77  int64 parent_build_id = 1;
78  // The UID of the individual CTP request which kicked off this test run.
79  // Note that distinct requests inside a multi-request CTP build will have
80  // different UIDs.
81  string parent_request_uid = 2;
82}
83
84// ProvisionTask is designed to be extensible to all provisions
85// that implement the GenericProvisionService, not just cros-provision.
86message ProvisionTask {
87  chromiumos.test.lab.api.IpEndpoint service_address = 1;
88  ProvisionStartupRequest startup_request = 2;
89  InstallRequest install_request = 3;
90  repeated DynamicDep dynamic_deps = 4;
91  // target refers to the device targeted for provision.
92  // i.e. primaryDevice, companionDevice_brya, companionDevice_brya_2
93  string target = 5;
94  // Task identifier for cross-referencing within dynamic dependencies.
95  string dynamic_identifier = 6;
96}
97
98// PreTestTask targets requests towards services that implement
99// the PreTestService.
100message PreTestTask {
101  chromiumos.test.lab.api.IpEndpoint service_address = 1;
102  google.protobuf.Any pre_test_request = 2;
103  repeated DynamicDep dynamic_deps = 3;
104  // Task identifier for cross-referencing within dynamic dependencies.
105  string dynamic_identifier = 4;
106}
107
108// TestTask targets requests towards services that implement
109// the ExecutionService.
110message TestTask {
111  chromiumos.test.lab.api.IpEndpoint service_address = 1;
112  CrosTestRequest test_request = 2;
113  repeated DynamicDep dynamic_deps = 3;
114  // Task identifier for cross-referencing within dynamic dependencies.
115  string dynamic_identifier = 4;
116}
117
118// PostTestTask targets requests towards services that implement
119// the PostTestService.
120// NEXT TAG: 8
121message PostTestTask {
122  chromiumos.test.lab.api.IpEndpoint service_address = 1;
123  google.protobuf.Any post_test_request = 2;
124  repeated DynamicDep dynamic_deps = 3;
125  PostTestStartUpRequest start_up_request = 6;
126  // RunActivityRequest will trigger a call to RunActivity
127  // within the rpc service `PostTestService`.
128  RunActivityRequest run_activity_request = 4;
129  // RunActivitiesRequest will trigger a call to RunActivities
130  // within the rpc service `PostTestService`.
131  RunActivitiesRequest run_activities_request = 7;
132  // Task identifier for cross-referencing within dynamic dependencies.
133  string dynamic_identifier = 5;
134}
135
136// PublishTask targets requests towards services that implement
137// the GenericPublishService.
138message PublishTask {
139  chromiumos.test.lab.api.IpEndpoint service_address = 1;
140  PublishRequest publish_request = 2;
141  repeated DynamicDep dynamic_deps = 3;
142  // Task identifier for cross-referencing within dynamic dependencies.
143  string dynamic_identifier = 4;
144}
145
146// GenericTask targets request towards services that implement
147// the GenericService.
148message GenericTask {
149  chromiumos.test.lab.api.IpEndpoint service_address = 1;
150  GenericStartRequest start_request = 2;
151  GenericRunRequest run_request = 3;
152  GenericStopRequest stop_request = 4;
153  repeated DynamicDep dynamic_deps = 5;
154  // Task identifier for cross-referencing within dynamic dependencies.
155  string dynamic_identifier = 6;
156}
157
158// Starts a container and uploads its IpEndpoint to TestRunnerV2's
159// dynamic map of locally exposed information.
160//
161// Will not support dynamic injections into the container's start arguments.
162// If the generic template is not enough, then a specific template should be
163// implemented.
164message ContainerRequest {
165  // Starting a binary within a container sometimes requires a "metadata"
166  // file or some type of proto file as input.
167  message FileInput {
168    string identifier = 1;
169    google.protobuf.Any content = 2;
170
171    // Dependencies to be injected within 'context'
172    repeated DynamicDep dynamic_deps = 3;
173  }
174
175  // Identifier for DynamicDependencies to inject this container's IpEndpoint, eg
176  // cros-provision, cros-dut, etc.
177  string dynamic_identifier = 1;
178  Template container = 2;
179  // Dynamic dependencies for the templated container.
180  repeated DynamicDep dynamic_deps = 3;
181  // Identifiable file inputs for the binary call within the generic container.
182  repeated FileInput inputs = 4;
183  // default = "host"
184  string network = 5;
185  // Lookup key for containers from the metadata.
186  string container_image_key = 6;
187  // Direct container image path to be called from docker.
188  // If set, used instead of the container_image_key.
189  string container_image_path = 7;
190}
191
192// Some information within TestRunnerV2 is required by the services it runs.
193// This information is not known at the time of request, and thus needs to be
194// dynamically injected within the request. This provides the definition
195// required to handle the injection, however, the exact object being injected is
196// unknown to this proto and must be handled by the implementation.
197message DynamicDep {
198  // camelCase object identifier, separated by "."
199  // ie dutServer.address
200  // If the key needs to point to an array index, simply put the index
201  // after the separator.
202  string key = 1;
203
204  // The identifier of the value within TestRunnerV2's map of
205  // locally exposed values.
206  // Separate by "." if an interior value of a top-level mapped
207  // object is required.
208  string value = 2;
209}
210