This allows tests to execute IO actions which have logging as a side
effect, without polluting the stderr too much.

A better solution would be that we have fine-grained control over
loggers, so that tests can run with their own logging, etc. etc..

Signed-off-by: Iustin Pop <ius...@google.com>
---
 htest/test.hs |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/htest/test.hs b/htest/test.hs
index 0a31d3d..7bb7df5 100644
--- a/htest/test.hs
+++ b/htest/test.hs
@@ -28,6 +28,7 @@ module Main(main) where
 import Data.Monoid (mappend)
 import Test.Framework
 import System.Environment (getArgs)
+import System.Log.Logger
 
 import Test.Ganeti.TestImports ()
 import Test.Ganeti.Attoparsec
@@ -120,4 +121,7 @@ main :: IO ()
 main = do
   ropts <- getArgs >>= interpretArgsOrExit
   let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
+  -- silence the logging system, so that tests can execute I/O actions
+  -- which create logs without polluting stderr
+  updateGlobalLogger rootLoggerName (setLevel EMERGENCY)
   defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts })
-- 
1.7.10.4

Reply via email to