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