diff options
author | Alex Bergman <abergman@google.com> | 2022-05-24 05:26:41 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-25 22:13:05 +0000 |
commit | 0f59b5e0db45fa207a42e4199d2e49501cbdb853 (patch) | |
tree | 3f15e93abb8cda664103f64e44c0eaa764fe6f4f | |
parent | 33b1614f1d2315ae3af45ad61dc20c211f646780 (diff) | |
download | autotest-0f59b5e0db45fa207a42e4199d2e49501cbdb853.tar.gz |
Restore platform_FetchCloudConfig Tauto test and make it Python3 compatible.
BUG=b:228087443
TEST=Manual run
Change-Id: I800b6d7d429bec232d1d9d98f8bc53626152a04b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3660236
Auto-Submit: Alex Bergman <abergman@google.com>
Reviewed-by: Afshin Sadrieh <asadrieh@google.com>
Tested-by: Alex Bergman <abergman@google.com>
Commit-Queue: Alex Bergman <abergman@google.com>
-rw-r--r-- | server/site_tests/platform_FetchCloudConfig/control | 24 | ||||
-rw-r--r-- | server/site_tests/platform_FetchCloudConfig/platform_FetchCloudConfig.py | 47 |
2 files changed, 71 insertions, 0 deletions
diff --git a/server/site_tests/platform_FetchCloudConfig/control b/server/site_tests/platform_FetchCloudConfig/control new file mode 100644 index 0000000000..86d923af94 --- /dev/null +++ b/server/site_tests/platform_FetchCloudConfig/control @@ -0,0 +1,24 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +AUTHOR = "abergman, chromeos-engprod-platform-syd" +NAME = "platform_FetchCloudConfig" +TIME = "SHORT" +TEST_CATEGORY = "Stress" +TEST_CLASS = "platform" +TEST_TYPE = "server" + +DOC = """ +This test doesn't run any actual tests, but rather loads a fresh copy of the +performance CUJ config from the cloud. + +This test is supposed to run in the beginning of performance CUJ test suite, to +ensure it always overrides cached configuration with the fresh one. +""" + +def run(machine): + host = hosts.create_host(machine) + job.run_test('platform_FetchCloudConfig', host=host, disable_sysinfo=True) + +parallel_simple(run, machines) diff --git a/server/site_tests/platform_FetchCloudConfig/platform_FetchCloudConfig.py b/server/site_tests/platform_FetchCloudConfig/platform_FetchCloudConfig.py new file mode 100644 index 0000000000..c4ecfb295f --- /dev/null +++ b/server/site_tests/platform_FetchCloudConfig/platform_FetchCloudConfig.py @@ -0,0 +1,47 @@ +# Lint as: python3 +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import common +import logging + +from autotest_lib.client.common_lib import error +from autotest_lib.client.common_lib.cros import dev_server +from autotest_lib.utils import labellib +from autotest_lib.server import test + + +class platform_FetchCloudConfig(test.test): + """Reload fresh performance CUJ cloud configuration from cloud.""" + version = 1 + + def run_once(self, host): + devservers = dev_server.ImageServer.get_available_devservers() + devserver_url = devservers[0][0] + if devserver_url: + logging.info('Using devserver: %s', devserver_url) + labels = host.host_info_store.get().labels + build = labellib.LabelsMapping(labels).get( + labellib.Key.CROS_VERSION) + if not build: + # Not able to detect build, means not running on Moblab. + raise error.TestFail('Unable to stage config on devserver %s, ' + 'probably not running in Moblab.' % + devserver_url) + ds = dev_server.ImageServer(devserver_url) + gs_bucket = dev_server._get_image_storage_server() + if gs_bucket: + config_path = 'config/perf_cuj/' + config_file = 'perf_cuj.config' + archive_url = gs_bucket + config_path + logging.info('Staging configuration from %s.', gs_bucket) + kwargs = {'clean': True} + ds.stage_artifacts(build, + archive_url=archive_url, + files=[config_file], + **kwargs) + else: + raise error.TestFail( + 'Invalid GS bucket %s for devserver %s.' % gs_bucket, + devserver_url) |