Update autoupdate_ForcedOOBEUpdate to use FakeOmaha.
I'll trial the TLS change with this test before migrating them all.
I cannot run the test locally with TLS so we will have to test in the
lab. I have verified that it runs and fails at the same point as the
infra_TLSFakeOmaha test.
BUG=chromium:1189379
TEST=autoupdate_ForcedOOBEUpdate and fails with same error as
infra_TLSFakeOmaha
Change-Id: I9f8782a213a719d2d7a29737462ff05a025f2648
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2815950
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
Reviewed-by: Kyle Shimabukuro <kyleshima@chromium.org>
(cherry picked from commit fb17b1a9a412f3e8037988f9c75b4314e80b9b37)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2861962
Reviewed-by: David Haddock <dhaddock@chromium.org>
Commit-Queue: David Haddock <dhaddock@chromium.org>
diff --git a/server/cros/update_engine/update_engine_test.py b/server/cros/update_engine/update_engine_test.py
index 8d734f7..20d481e 100644
--- a/server/cros/update_engine/update_engine_test.py
+++ b/server/cros/update_engine/update_engine_test.py
@@ -32,6 +32,8 @@
from chromite.lib import auto_updater_transfer
from chromite.lib import remote_access
from chromite.lib import retry_util
+from autotest_lib.server.hosts.tls_client import connection
+from autotest_lib.server.hosts.tls_client import fake_omaha
class UpdateEngineTest(test.test, update_engine_util.UpdateEngineUtil):
@@ -775,6 +777,56 @@
return url
+ def get_update_url_from_fake_omaha(self,
+ job_repo_url=None,
+ full_payload=True,
+ payload_id='ROOTFS',
+ critical_update=True,
+ exposed_via_proxy=True,
+ return_noupdate_starting=0):
+ """
+ Starts a FakeOmaha instance with TLS and returns is update url.
+
+ Some tests that require an omaha instance to survive a reboot will use
+ the FakeOmaha TLS.
+
+ @param job_repo_url: string url containing the current build.
+ @param full_payload: bool whether we want a full payload.
+ @param payload_id: ROOTFS or DLC
+ @param critical_update: True if we want a critical update response.
+ @param exposed_via_proxy: True to tell TLS we want the fakeomaha to be
+ accessible after a reboot.
+ @param return_noupdate_starting: int of how many valid update responses
+ to return before returning noupdate
+ forever.
+
+ @returns an update url on the FakeOmaha instance for tests to use.
+
+ """
+ self._job_repo_url = self._get_job_repo_url(job_repo_url)
+ if not self._job_repo_url:
+ raise error.TestFail('There was no job_repo_url so we cannot get '
+ 'a payload to use.')
+ gs = dev_server._get_image_storage_server()
+ _, build = tools.get_devserver_build_from_package_url(
+ self._job_repo_url)
+ target_build = gs + build
+ payload_type = 'FULL' if full_payload else 'DELTA'
+ tlsconn = connection.TLSConnection()
+ self.fake_omaha = fake_omaha.TLSFakeOmaha(tlsconn)
+ fake_omaha_url = self.fake_omaha.start_omaha(
+ self._host.hostname,
+ target_build=target_build,
+ payloads=[{
+ 'payload_id': payload_id,
+ 'payload_type': payload_type,
+ }],
+ exposed_via_proxy=True,
+ critical_update=critical_update,
+ return_noupdate_starting=return_noupdate_starting)
+ logging.info('Fake Omaha update URL: %s', fake_omaha_url)
+ return fake_omaha_url
+
def get_payload_url_on_public_bucket(self, job_repo_url=None,
full_payload=True, is_dlc=False):
"""
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
index 7fe8375..3fa95ef 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
@@ -67,6 +67,8 @@
# if status is IDLE we need to figure out if an error occurred
# or the DUT autorebooted.
elif self._is_update_engine_idle(status):
+ self._host.run(
+ 'ls /mnt/stateful_partition/etc/lsb-release')
if self._is_update_finished_downloading(last_status):
if len(self._get_update_engine_logs()) > logs_before:
return
@@ -129,8 +131,14 @@
payload_url = self.get_payload_url_on_public_bucket(
job_repo_url, full_payload=full_payload)
else:
- update_url = self.get_update_url_for_test(
- job_repo_url, full_payload=full_payload)
+ if moblab:
+ update_url = self.get_update_url_for_test(
+ job_repo_url, full_payload=full_payload)
+ else:
+ update_url = self.get_update_url_from_fake_omaha(
+ job_repo_url,
+ full_payload=full_payload,
+ return_noupdate_starting=2)
before_version = self._host.get_release_version()
# Clear any previously started updates.