update_engine_test: Check for job_repo_url before restoring stateful.
If an AU test that expects to be able to restore stateful at the end
fails early (e.g on the first login), it won't have a
job_repo_url set yet and this code won't be able to execute.
A check and return early in this case
BUG=b:194859394
TEST=autoupdate_Basic
Change-Id: If3c9c4a7f07fb9f94d00a6ebd5013fa3bb05b118
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/3064585
Tested-by: David Haddock <dhaddock@chromium.org>
Commit-Queue: David Haddock <dhaddock@chromium.org>
Reviewed-by: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Kyle Shimabukuro <kyleshima@chromium.org>
diff --git a/server/cros/update_engine/update_engine_test.py b/server/cros/update_engine/update_engine_test.py
index ca83a02..f35eda5 100644
--- a/server/cros/update_engine/update_engine_test.py
+++ b/server/cros/update_engine/update_engine_test.py
@@ -95,6 +95,7 @@
self._dlc_util = dlc_util.DLCUtil(self._run)
self._fake_omaha = None
+ self._job_repo_url = None
def cleanup(self):
"""Clean up update_engine autotests."""
@@ -728,6 +729,10 @@
def _restore_stateful(self):
"""Restore the stateful partition after a destructive test."""
+ # Test failed before job_repo_url was set. No need to fix stateful.
+ if not self._job_repo_url:
+ return
+
# Fallback to lab provisioning if this function fails to restore.
self._run(['touch', self._CORRUPT_STATEFUL_PATH])