Commit 25231ec5 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Ignore log messages in unittests


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 7e9c6a78
......@@ -149,4 +149,4 @@ class TestManpages(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
testutils.GanetiTestProgram()
......@@ -25,10 +25,11 @@
import os
import unittest
import testutils
from ganeti import bdev
from ganeti import errors
import testutils
class TestDRBD8Runner(testutils.GanetiTestCase):
"""Testing case for DRBD8"""
......@@ -189,4 +190,4 @@ class TestDRBD8Status(testutils.GanetiTestCase):
stats.is_disk_uptodate)
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -26,10 +26,12 @@ from cStringIO import StringIO
import ganeti
import testutils
from ganeti import constants
from ganeti import cli
from ganeti.errors import OpPrereqError, ParameterError
class TestParseTimespec(unittest.TestCase):
"""Testing case for ParseTimespec"""
......@@ -123,4 +125,4 @@ class TestToStream(unittest.TestCase):
self.failUnlessEqual(buf.getvalue(), "foo a b\n")
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -30,6 +30,8 @@ import Queue
from ganeti import cmdlib
from ganeti import errors
import testutils
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -30,6 +30,8 @@ from ganeti import errors
import ganeti.confd.client
import testutils
class ResettableMock(object):
def __init__(self, *args, **kwargs):
......@@ -182,4 +184,4 @@ class TestClient(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -36,6 +36,8 @@ from ganeti import errors
from ganeti import objects
from ganeti import utils
import testutils
class TestConfigRunner(unittest.TestCase):
"""Testing case for HooksRunner"""
......@@ -176,4 +178,4 @@ class TestConfigRunner(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -27,6 +27,8 @@ import re
from ganeti import constants
import testutils
class TestConstants(unittest.TestCase):
"""Constants tests"""
......@@ -99,4 +101,4 @@ class TestConfdConstants(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -39,11 +39,15 @@ from ganeti.constants import HKR_SUCCESS, HKR_FAIL, HKR_SKIP
from mocks import FakeConfig, FakeProc, FakeContext
import testutils
class FakeLU(cmdlib.LogicalUnit):
HPATH = "test"
def BuildHooksEnv(self):
return {}, ["localhost"], ["localhost"]
class TestHooksRunner(unittest.TestCase):
"""Testing case for HooksRunner"""
def setUp(self):
......@@ -266,5 +270,6 @@ class TestHooksMaster(unittest.TestCase):
for phase in (constants.HOOKS_PHASE_PRE, constants.HOOKS_PHASE_POST):
hm.RunPhase(phase)
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -32,6 +32,8 @@ import ganeti.http.server
import ganeti.http.client
import ganeti.http.auth
import testutils
class TestStartLines(unittest.TestCase):
"""Test cases for start line classes"""
......@@ -163,4 +165,4 @@ class TestAuth(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -31,6 +31,8 @@ import threading
from ganeti import locking
from ganeti import errors
import testutils
# This is used to test the ssynchronize decorator.
# Since it's passed as input to a decorator it must be declared as a global.
......@@ -1405,6 +1407,4 @@ class TestGanetiLockManager(_ThreadedTestCase):
if __name__ == '__main__':
unittest.main()
#suite = unittest.TestLoader().loadTestsFromTestCase(TestSharedLock)
#unittest.TextTestRunner(verbosity=2).run(suite)
testutils.GanetiTestProgram()
......@@ -26,6 +26,8 @@ import unittest
from ganeti import mcpu
import testutils
class TestLockAttemptTimeoutStrategy(unittest.TestCase):
def testConstants(self):
......@@ -58,4 +60,4 @@ class TestLockAttemptTimeoutStrategy(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
testutils.GanetiTestProgram()
......@@ -26,9 +26,13 @@ import unittest
from ganeti import objects
import testutils
class SimpleObject(objects.ConfigObject):
__slots__ = ['a', 'b']
class TestDictState(unittest.TestCase):
"""Simple dict tansformation tests"""
......@@ -45,4 +49,4 @@ class TestDictState(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -31,6 +31,8 @@ from ganeti import http
from ganeti.rapi import connector
from ganeti.rapi import rlib2
import testutils
class MapperTests(unittest.TestCase):
"""Tests for remote API URI mapper."""
......@@ -82,4 +84,4 @@ class R_RootTests(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -80,4 +80,4 @@ class TestSerializer(testutils.GanetiTestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -49,4 +49,4 @@ class TestKnownHosts(testutils.GanetiTestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -1043,4 +1043,4 @@ class TestFormatTime(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -29,6 +29,8 @@ import zlib
from ganeti import workerpool
import testutils
class DummyBaseWorker(workerpool.BaseWorker):
def RunTask(self, text):
......@@ -136,4 +138,4 @@ class TestWorkerpool(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
testutils.GanetiTestProgram()
......@@ -25,6 +25,7 @@ import os
import stat
import tempfile
import unittest
import logging
from ganeti import utils
......@@ -33,6 +34,15 @@ def GetSourceDir():
return os.environ.get("TOP_SRCDIR", ".")
class GanetiTestProgram(unittest.TestProgram):
def runTests(self):
"""
"""
logging.basicConfig(filename=os.devnull)
return unittest.TestProgram.runTests(self)
class GanetiTestCase(unittest.TestCase):
"""Helper class for unittesting.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment