summaryrefslogtreecommitdiffstats
path: root/ipatests/beakerlib_plugin.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-06-25 12:29:25 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-07-15 15:49:14 +0200
commitc47f3154be16a096b2d255c654e2277954b14833 (patch)
tree8476fce00eabfd52576acde8d3ec899aea6dbd15 /ipatests/beakerlib_plugin.py
parent19a0d51d89b640c04dc285067fc59b4a7fe9ca7f (diff)
downloadfreeipa.git-c47f3154be16a096b2d255c654e2277954b14833.tar.gz
freeipa.git-c47f3154be16a096b2d255c654e2277954b14833.tar.xz
freeipa.git-c47f3154be16a096b2d255c654e2277954b14833.zip
Make BeakerLib logging less verbose
Logs from Beaker jobs are normally very brief, with the standard output/error containing detailed information. Make ipa-run-tests with BeakerLib plugin follow this convention. Only include INFO and higher level messages in the Beaker logs. Downgrade several message levels to DEBUG. Log to console using Python logging instead of showing the Beaker logs. Since ipa-run-tests sets up its own logging, Nose's own log handling just causes duplicate messages. Disable it with --nologcapture.
Diffstat (limited to 'ipatests/beakerlib_plugin.py')
-rw-r--r--ipatests/beakerlib_plugin.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/ipatests/beakerlib_plugin.py b/ipatests/beakerlib_plugin.py
index 8857a284..7c27c165 100644
--- a/ipatests/beakerlib_plugin.py
+++ b/ipatests/beakerlib_plugin.py
@@ -76,7 +76,9 @@ class BeakerLibPlugin(Plugin):
# Set up the Bash process
self.bash = subprocess.Popen(['bash'],
- stdin=subprocess.PIPE)
+ stdin=subprocess.PIPE,
+ stdout=open('/dev/null', 'w'),
+ stderr=open('/dev/null', 'w'))
source_path = os.path.join(self.env['BEAKERLIB'], 'beakerlib.sh')
self.run_beakerlib_command(['.', source_path])
@@ -88,16 +90,12 @@ class BeakerLibPlugin(Plugin):
self.setup_log_handler(BeakerLibLogHandler(self.run_beakerlib_command))
def setup_log_handler(self, handler):
- # Remove the console handler (BeakerLib will print to stderr)
- if 'console' in log_mgr.handlers:
- log_mgr.remove_handler('console')
- # Configure our logger
log_mgr.configure(
{
'default_level': 'DEBUG',
'handlers': [{'log_handler': handler,
'format': '[%(name)s] %(message)s',
- 'level': 'debug'}]},
+ 'level': 'info'}]},
configure_state='beakerlib_plugin')
def run_beakerlib_command(self, cmd):
@@ -207,7 +205,6 @@ class BeakerLibPlugin(Plugin):
tarname = os.path.join(dirname, 'logs.tar.xz')
with open(tarname, 'w') as f:
f.write(cmd.stdout_text)
- self.log.info('%s', dirname)
ipautil.run(['tar', 'xJvf', 'logs.tar.xz'], cwd=dirname)
os.unlink(tarname)
@@ -219,7 +216,7 @@ class BeakerLibPlugin(Plugin):
for filename in filenames:
fullname = os.path.relpath(
os.path.join(dirpath, filename), topdirname)
- self.log.info('Submitting file: %s', fullname)
+ self.log.debug('Submitting file: %s', fullname)
self.run_beakerlib_command(['rlFileSubmit', fullname])
self.run_beakerlib_command(['popd'])