lib/operation: cleanup output on failure
Currently, on failure of a brillo operation with a progress bar,
a lot of output is produced. This cleans up the output and
points to user to files where more information can be found.
BUG=brillo:1026
TEST=unittest
Change-Id: I0a2235ff7e1ee2b1360e25bcda5fec3492a81408
Reviewed-on: https://chromium-review.googlesource.com/270817
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ralph Nathan <ralphnathan@chromium.org>
Trybot-Ready: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
diff --git a/cli/command_unittest.py b/cli/command_unittest.py
index a7349a0..f629b0e 100644
--- a/cli/command_unittest.py
+++ b/cli/command_unittest.py
@@ -17,6 +17,7 @@
from chromite.lib import cros_logging as logging
from chromite.lib import cros_test_lib
from chromite.lib import partial_mock
+from chromite.lib import workspace_lib
# pylint:disable=protected-access
@@ -174,7 +175,8 @@
# Test that the filename is correct.
patch_handler.assert_called_with(
- os.path.join(self.workspace_path, 'build/logs', 'foo.log'), mode='w')
+ os.path.join(self.workspace_path, workspace_lib.WORKSPACE_LOGS_DIR,
+ 'foo.log'), mode='w')
def testSetupFileLoggerNoFilename(self):
"""Test that the filename and path are correct with no arguments."""
@@ -184,7 +186,8 @@
# Test that the filename is correct.
patch_handler.assert_called_with(
- os.path.join(self.workspace_path, 'build/logs', 'brillo.log'), mode='w')
+ os.path.join(self.workspace_path, workspace_lib.WORKSPACE_LOGS_DIR,
+ 'brillo.log'), mode='w')
def testSetupFileLoggerLogLevels(self):
"""Test that the logger operates at the right level."""
@@ -196,7 +199,8 @@
# Test that the logs are correct.
logs = open(
- os.path.join(self.workspace_path, 'build/logs', 'foo.log'), 'r').read()
+ os.path.join(self.workspace_path, workspace_lib.WORKSPACE_LOGS_DIR,
+ 'foo.log'), 'r').read()
self.assertNotIn('debug', logs)
self.assertIn('info', logs)
self.assertIn('notice', logs)