1# Lint as: python2, python3 2# Copyright 2020 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6from autotest_lib.client.common_lib.cros import kernel_utils 7from autotest_lib.server.cros.update_engine import update_engine_test 8 9 10class autoupdate_Periodic(update_engine_test.UpdateEngineTest): 11 """This verifies periodic update checks by update_engine.""" 12 version = 1 13 14 def run_once(self, 15 periodic_interval=5, 16 full_payload=True, 17 job_repo_url=None, 18 running_at_desk=False): 19 """ 20 Runs the periodic update check test. 21 22 @param periodic_interval: Seconds between each periodic update check. 23 @param full_payload: True for full payload. False for delta. 24 @param job_repo_url: A url pointing to the devserver where the autotest 25 package for this build should be staged. 26 @param running_at_desk: True if the test is being run locally. 27 28 """ 29 # Get a payload to use for the test. 30 payload_url = self.get_payload_for_nebraska( 31 job_repo_url, 32 full_payload=full_payload, 33 public_bucket=running_at_desk) 34 35 # Record kernel state before any updates. 36 active, inactive = kernel_utils.get_kernel_state(self._host) 37 38 # Check that the periodic update checks are activated and fire. 39 self._run_client_test_and_check_result( 40 'autoupdate_PeriodicCheck', 41 payload_url=payload_url, 42 periodic_interval=periodic_interval) 43 44 # Verify the update completed successfully. 45 self._host.reboot() 46 rootfs_hostlog, _ = self._create_hostlog_files( 47 ignore_event_rootfs=True) 48 self.verify_update_events(self._CUSTOM_LSB_VERSION, rootfs_hostlog) 49 kernel_utils.verify_boot_expectations(inactive, host=self._host) 50