示例#1
0
 def testSplitDailyDir_004(self):
     """
     Test with 99,999 byte limit, chopped down to 5,000 bytes
     """
     self.extractTar("tree21")
     dailyDir = self.buildPath(["tree21", "2007", "01", "01"])
     self.assertTrue(os.path.exists(dailyDir) and os.path.isdir(dailyDir))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file001.a.b")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file003")))
     sizeLimit = ByteQuantity("99999", UNIT_BYTES)
     splitSize = ByteQuantity("5000", UNIT_BYTES)
     _splitDailyDir(dailyDir, sizeLimit, splitSize, None, None)
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file001.a.b")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file002")))
     self.assertFalse(os.path.exists(pathJoin(dailyDir, "system1", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file002")))
     self.assertFalse(os.path.exists(pathJoin(dailyDir, "system2", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file001")))
     self.assertFalse(os.path.exists(pathJoin(dailyDir, "system3", "file002")))
     self.assertFalse(os.path.exists(pathJoin(dailyDir, "system3", "file003")))
     self.checkSplit(pathJoin(dailyDir, "system1", "file003"), 320000, 5000)
     self.checkSplit(pathJoin(dailyDir, "system2", "file003"), 100000, 5000)
     self.checkSplit(pathJoin(dailyDir, "system3", "file002"), 100000, 5000)
     self.checkSplit(pathJoin(dailyDir, "system3", "file003"), 100001, 5000)
示例#2
0
 def testSplitDailyDir_002(self):
     """
     Test with 1.0 MB limit.
     """
     self.extractTar("tree21")
     dailyDir = self.buildPath(["tree21", "2007", "01", "01"])
     self.assertTrue(os.path.exists(dailyDir) and os.path.isdir(dailyDir))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file001.a.b")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file003")))
     sizeLimit = ByteQuantity("1.0", UNIT_MBYTES)
     splitSize = ByteQuantity("100000", UNIT_BYTES)
     _splitDailyDir(dailyDir, sizeLimit, splitSize, None, None)
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file001.a.b")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system1", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system2", "file003")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file001")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file002")))
     self.assertTrue(os.path.exists(pathJoin(dailyDir, "system3", "file003")))