|
|
@ -24,6 +24,7 @@ __license__ = "GPL"
|
|
|
|
|
|
|
|
|
|
|
|
from __builtin__ import open as fopen
|
|
|
|
from __builtin__ import open as fopen
|
|
|
|
import unittest
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
import getpass
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import time
|
|
|
@ -349,10 +350,20 @@ class LogFileMonitor(LogCaptureTestCase):
|
|
|
|
# shorter wait time for not modified status
|
|
|
|
# shorter wait time for not modified status
|
|
|
|
return not self.isModified(0.4)
|
|
|
|
return not self.isModified(0.4)
|
|
|
|
|
|
|
|
|
|
|
|
def testNoLogFile(self):
|
|
|
|
def testUnaccessibleLogFile(self):
|
|
|
|
os.chmod(self.name, 0)
|
|
|
|
os.chmod(self.name, 0)
|
|
|
|
self.filter.getFailures(self.name)
|
|
|
|
self.filter.getFailures(self.name)
|
|
|
|
self.assertTrue(self._is_logged('Unable to open %s' % self.name))
|
|
|
|
failure_was_logged = self._is_logged('Unable to open %s' % self.name)
|
|
|
|
|
|
|
|
is_root = getpass.getuser() == 'root'
|
|
|
|
|
|
|
|
# If ran as root, those restrictive permissions would not
|
|
|
|
|
|
|
|
# forbid log to be read.
|
|
|
|
|
|
|
|
self.assertTrue(failure_was_logged != is_root)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def testNoLogFile(self):
|
|
|
|
|
|
|
|
_killfile(self.file, self.name)
|
|
|
|
|
|
|
|
self.filter.getFailures(self.name)
|
|
|
|
|
|
|
|
failure_was_logged = self._is_logged('Unable to open %s' % self.name)
|
|
|
|
|
|
|
|
self.assertTrue(failure_was_logged)
|
|
|
|
|
|
|
|
|
|
|
|
def testRemovingFailRegex(self):
|
|
|
|
def testRemovingFailRegex(self):
|
|
|
|
self.filter.delFailRegex(0)
|
|
|
|
self.filter.delFailRegex(0)
|
|
|
|