gce_au_worker: Allow custom tests and flags
One major advantage of running tests on GCE is the potential to run tests with
different GCE instance property permutations, for example, some tests may
require an instance to start with a certain metadata, or a benchmark may desire
to run tests with different types of machines, e.g., n1-standard-1 or
n1-standard-8. This CL enables this ability by allowing board overlays to
declare their requirement of instance properties in a JSON file, and to group
tests based on their environmental request.
Board overlays will have a JSON file, i.e., <overlay>/scripts/gce_tests.json,
that define the list of tests that they would like to run to verify the built
image, in the format of,
, where each test object can be any valid Autotest test case, or a suite of
tests, e.g., "suite:smoke". Each test object will have two members - name
and flags. flags is a JSON object, containing key-value pairs that follow
the exact schemas of GCE Instance Resource properties as listed here:
mis-formed key-value pair will result in an instance creation failure.
On the absence of such a JSON file, the smoke suite will be run on an instance
created with default flags.
As all tests share a GCP project thats managed by cros-infras team, and
allowing arbitrary instance properties may introduce undesired surprises, we
only whitelist trusted boards to use this feature.
This CL also updates lib/gce.py with a thread-safe service client, which adds to
memory footprint, so the original non-thread-safe one is kept as default.
TEST=au_test_harness/gce_au_worker_unittest.py and trybot run against
Commit-Ready: Daniel Wang <firstname.lastname@example.org>
Tested-by: Daniel Wang <email@example.com>
Reviewed-by: Aditya Kali <firstname.lastname@example.org>
Reviewed-by: Daniel Wang <email@example.com>
5 files changed