• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6import logging
7
8from autotest_lib.client.common_lib import error
9from autotest_lib.client.cros.update_engine import nebraska_wrapper
10from autotest_lib.client.cros.update_engine import update_engine_test
11
12class autoupdate_InstallAndUpdateDLC(update_engine_test.UpdateEngineTest):
13    """Tests installing DLCs and updating them along with the OS. """
14    version = 1
15
16    def run_once(self, payload_urls, interactive=True):
17        """
18        Install DLC and perform an update, using nebraska.
19
20        @param payload_urls: A list containing the platform payload (OS) URL
21                             and DLC payload URL(s). The platform payload is
22                             required, since DLCs are updated together with
23                             the platform. A full DLC payload is required to
24                             install the DLC. In case of a delta update, both
25                             full and delta DLC payloads should be included in
26                             payload_urls.
27        @param interactive: Whether the update should be interactive.
28
29        """
30        with nebraska_wrapper.NebraskaWrapper(
31                payload_url=payload_urls) as nebraska:
32            nebraska_url = nebraska.get_update_url(critical_update=True)
33            logging.debug('Installing sample-dlc')
34            # Nebraska will automatically use the full payload to install DLC.
35            self._dlc_util.install(self._dlc_util._SAMPLE_DLC_ID, nebraska_url)
36
37            if not self._dlc_util.is_installed(self._dlc_util._SAMPLE_DLC_ID):
38                raise error.TestFail('Test DLC was not installed.')
39
40            logging.debug('Updating OS and DLC')
41            self._check_for_update(nebraska_url,
42                                   wait_for_completion=True,
43                                   interactive=interactive)
44