コード例 #1
0
ファイル: test_rotatelib_s3.py プロジェクト: pnmg/rotatelib
 def testRemoveItems(self):
     archives = rotatelib.list_archives(s3bucket=TEST_BUCKET_NAME)
     rotatelib.remove_items(items=archives, s3bucket=TEST_BUCKET_NAME)
     archives = rotatelib.list_archives(s3bucket=TEST_BUCKET_NAME)
     self.assertEqual(len(archives), 0)
     archives = rotatelib.list_archives(s3bucket=TEST_BUCKET_NAME, has_date=False)
     self.assertEqual(len(archives), 1)
コード例 #2
0
ファイル: test_rotatelib.py プロジェクト: kschaller/rotatelib
 def testRemoveTablesWithPatternCriteria(self):
     tables = ['tableA', 'tableB', 'tableA20090922T162037', 'steveA20090922T162037', 'table%s' % datetime.date.today().strftime("%Y%m%d")]
     db = sqlite3.connect(':memory:')
     self.create_tables(db, tables)
     tables = rotatelib.list_backup_tables(db, before=datetime.timedelta(1), pattern='steve.*')
     self.assertEqual(len(tables), 1)
     rotatelib.remove_items(db=db, items=tables)
     tables = rotatelib.list_backup_tables(db, before=datetime.timedelta(1))
     self.assertEqual(len(tables), 1)
     cur = db.cursor()
     cur.execute("SELECT * FROM sqlite_master WHERE type='table'")
     tables = cur.fetchall()
     self.assertEqual(len(tables), 4)
コード例 #3
0
 def testRemoveTablesWithCriteria(self):
     tables = [
         'tableA', 'tableB', 'tableA20090922T162037',
         'table%s' % datetime.date.today().strftime("%Y%m%d")
     ]
     db = sqlite3.connect(':memory:')
     self.create_tables(db, tables)
     tables = rotatelib.list_backup_tables(db, before=datetime.timedelta(1))
     self.assertEqual(len(tables), 1)
     rotatelib.remove_items(db=db, items=tables)
     tables = rotatelib.list_backup_tables(db, before=datetime.timedelta(1))
     self.assertEqual(len(tables), 0)
     cur = db.cursor()
     cur.execute("SELECT * FROM sqlite_master WHERE type='table'")
     tables = cur.fetchall()
     self.assertEqual(len(tables), 3)
コード例 #4
0
ファイル: test_rotatelib_s3.py プロジェクト: pnmg/rotatelib
 def testRemoveItems(self):
     archives = rotatelib.list_archives(ec2snapshots=True, startswith="rotatelib")
     self.assertEqual(len(archives), 1)
     rotatelib.remove_items(items=archives, ec2snapshots=True)
     archives = rotatelib.list_archives(ec2snapshots=True, startswith="rotatelib")
     self.assertEqual(len(archives), 0)