Home | History | Annotate | Download | only in autoupdate_Cellular
      1 # Copyright 2018 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 
      5 from autotest_lib.server.cros.update_engine import update_engine_test
      6 
      7 class autoupdate_Cellular(update_engine_test.UpdateEngineTest):
      8     """
      9     Tests auto updating over cellular.
     10 
     11     Usually with AU tests we use a lab devserver to hold the payload, and to be
     12     the omaha instance that DUTs ping. However, over cellular they will not be
     13     able to reach the devserver. So we will need to put the payload on a
     14     public google storage location. We will setup an omaha instance on the DUT
     15     (via autoupdate_CannedOmahaUpdate) that points to the payload on GStorage.
     16 
     17     """
     18     version = 1
     19 
     20 
     21     def cleanup(self):
     22         self._change_cellular_setting_in_update_engine(False)
     23         self._host.reboot()
     24 
     25 
     26     def run_once(self, job_repo_url=None, full_payload=True):
     27         update_url = self.get_update_url_for_test(job_repo_url,
     28                                                   full_payload=full_payload,
     29                                                   public=True)
     30 
     31         # gs://chromeos-image-archive does not contain a handy .json file
     32         # with the payloads size and SHA256 info like we have for payloads in
     33         # gs://chromeos-releases. So in order to get this information we need
     34         # to use a devserver to stage the payloads and then call the fileinfo
     35         # API with the staged file URL. This will return the fields we need.
     36         payload = self._get_payload_url(full_payload=full_payload)
     37         staged_url = self._stage_payload_by_uri(payload)
     38         file_info = self._get_staged_file_info(staged_url)
     39 
     40         self._change_cellular_setting_in_update_engine(True)
     41         self._run_client_test_and_check_result('autoupdate_CannedOmahaUpdate',
     42                                                image_url=update_url,
     43                                                image_size=file_info['size'],
     44                                                image_sha256=file_info['sha256'],
     45                                                use_cellular=True,
     46                                                is_delta=not full_payload)
     47         self._check_for_cellular_entries_in_update_log()
     48