def testNineToTenLogs(self):
   """Test handling *.log.9 to *.log.10 (correct sorting)."""
   self._generateLogs(9)
   cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, 'cbuildbot.log'),
                                backup_limit=25)
   with open(os.path.join(self.tempdir, 'cbuildbot.log.10')) as f:
     self.assertEquals(f.readline(), '10')
 def testZeroToOneLogs(self):
   """Test beginning corner case."""
   self._generateLogs(0)
   cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, 'cbuildbot.log'),
                                backup_limit=25)
   with open(os.path.join(self.tempdir, 'cbuildbot.log.1')) as f:
     self.assertEquals(f.readline(), '1')
示例#3
0
 def testNineToTenLogs(self):
   """Test handling *.log.9 to *.log.10 (correct sorting)."""
   self._generateLogs(9)
   cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, 'cbuildbot.log'),
                                backup_limit=25)
   with open(os.path.join(self.tempdir, 'cbuildbot.log.10')) as f:
     self.assertEquals(f.readline(), '10')
示例#4
0
 def testZeroToOneLogs(self):
   """Test beginning corner case."""
   self._generateLogs(0)
   cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, 'cbuildbot.log'),
                                backup_limit=25)
   with open(os.path.join(self.tempdir, 'cbuildbot.log.1')) as f:
     self.assertEquals(f.readline(), '1')
    def testOverLimit(self):
        """Test going over the limit and having to purge old logs."""
        self._generateLogs(25)
        cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, "cbuildbot.log"), backup_limit=25)
        with open(os.path.join(self.tempdir, "cbuildbot.log.26")) as f:
            self.assertEquals(f.readline(), "26")

        self.assertEquals(len(glob.glob(os.path.join(self.tempdir, "cbuildbot*"))), 25)
示例#6
0
  def testOverLimit(self):
    """Test going over the limit and having to purge old logs."""
    self._generateLogs(25)
    cbuildbot._BackupPreviousLog(os.path.join(self.tempdir, 'cbuildbot.log'),
                                 backup_limit=25)
    with open(os.path.join(self.tempdir, 'cbuildbot.log.26')) as f:
      self.assertEquals(f.readline(), '26')

    self.assertEquals(len(glob.glob(os.path.join(self.tempdir, 'cbuildbot*'))),
                      25)