Make some AU failures clearer.

This CL improves error messaging when DUTs fail to reconnect.
This fixes a failure where getting the update status throws an error.

BUG=None
TEST=None

Change-Id: Ibc9d0021afeb54ebfc2664e1859efd1d7b68e56e
Reviewed-on: https://chromium-review.googlesource.com/1137712
Commit-Ready: David Haddock <dhaddock@chromium.org>
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Katherine Threlkeld <kathrelkeld@chromium.org>
diff --git a/client/cros/update_engine/update_engine_test.py b/client/cros/update_engine/update_engine_test.py
index 780fe14..69b6ce6 100644
--- a/client/cros/update_engine/update_engine_test.py
+++ b/client/cros/update_engine/update_engine_test.py
@@ -52,7 +52,8 @@
                                                     tries=3, timeout=10) == 0,
                                  timeout=60,
                                  sleep_interval=1,
-                                 desc='Ping after reconnecting network.')
+                                 exception=error.TestFail(
+                                     'Ping failed after reconnecting network'))
 
 
     def _disable_internet(self, ping_server='google.com'):
diff --git a/client/cros/update_engine/update_engine_util.py b/client/cros/update_engine/update_engine_util.py
index 9b1b4ac..141a50e 100644
--- a/client/cros/update_engine/update_engine_util.py
+++ b/client/cros/update_engine/update_engine_util.py
@@ -85,11 +85,17 @@
 
     def _wait_for_update_to_fail(self):
         """Waits for the update to retry until failure."""
+        timeout_minutes = 20
+        timeout = time.time() + 60 * timeout_minutes
         while True:
             if self._check_update_engine_log_for_entry('Reached max attempts ',
                                                        raise_error=False):
                 break
             time.sleep(1)
+            if time.time() > timeout:
+                raise error.TestFail('Update did not fail as expected. Timeout'
+                                     ': %d minutes.' % timeout_minutes)
+
 
 
     def _wait_for_update_to_complete(self, finalizing_ok=False):
@@ -120,10 +126,10 @@
             time.sleep(1)
 
 
-    def _get_update_engine_status(self, timeout=3600):
+    def _get_update_engine_status(self, timeout=3600, ignore_status=True):
         """Returns a dictionary version of update_engine_client --status"""
         status = self._run('update_engine_client --status', timeout=timeout,
-                           ignore_timeout=True)
+                           ignore_timeout=True, ignore_status=ignore_status)
         if status is None:
             return None
         logging.debug(status)