def test_forceentry(self): os.environ['ListAge'] = '5' os.environ['InventoryAge'] = '5' summary.opts.UPDATESUMMARY = True main.main(picker.pick_site()) self.assertTrue(self.entry())
def test_yesmore(self): dynamo_consistency.opts.MORELOGS = True site = picker.pick_site() main.main(site) unmerged = history.unmerged_files(site) self.assertTrue('/store/logs/prod/recent/test.tar.gz' in unmerged) self.assertFalse('/store/logs/prod/nope/test.tar.gz' in unmerged)
def test_othersite(self): dynamo_consistency.opts.MORELOGS = True config.config_dict() config.CONFIG['AdditionalLogDeletions']['TEST_SITE2'] = config.CONFIG['AdditionalLogDeletions'].pop('TEST_SITE') site = picker.pick_site() main.main(site) self.assertTrue(history.orphan_files(site)) unmerged = history.unmerged_files(site) self.assertFalse('/store/logs/prod/recent/test.tar.gz' in unmerged) self.assertFalse('/store/logs/prod/nope/test.tar.gz' in unmerged)
def test_prevmissing(self): # Check that missing only shows up after two consecutive, if missing file there site = picker.pick_site() with open('www/%s_compare_missing.txt' % site, 'w') as missing: pass main.main(site) self.assertFalse(main.registry.transfered) self.assertFalse(history.missing_files(site)) main.main(site) self.assertEqual(history.missing_files(main.config.SITE), ['/store/data/runB/0003/missing.root'])
def test_crash(self): site = picker.pick_site() summary.running(site) main.main(site) summary.unlock_site(site) self.assertFalse(history.unmerged_files(site)) # Test for completed run report conn = summary.LockedConn() results = conn.execute('SELECT * FROM stats;') self.assertTrue(list(results))
def test_main(self): main.main(picker.pick_site()) self.assertFalse(history.RUN) # See dynamo_consistency.backend.test for expected results self.assertEqual(history.missing_files(main.config.SITE), ['/store/data/runB/0003/missing.root']) self.assertEqual(history.orphan_files(main.config.SITE), ['/store/data/runB/0001/orphan.root']) self.assertEqual(history.empty_directories(main.config.SITE), [ '/store/data/runC/0000/emtpy/dir', '/store/data/runC/0000/emtpy', '/store/data/runC/0000', '/store/data/runC' ])
def test_signaling(self): site = picker.pick_site() main.main(site) summary.unlock_site(site) self.assertEqual(summary.get_status(site), summary.READY) signaling.halt(2, 'dummy') self.assertEqual(summary.get_status(site), summary.HALT) summary.set_status(site, summary.DISABLED) signaling.halt(2, 'dummy') self.assertEqual(summary.get_status(site), summary.DISABLED)
def test_duplog(self): summary.unlock_site('TEST_SITE') logsetup.change_logfile('logs/test.log') main.main(picker.pick_site('TEST_SITE')) summary.unlock_site('TEST_SITE') deletion_lines = 0 with open('logs/test.log', 'r') as check: for line in check: if 'INFO:dynamo_consistency.dynamo.v1.registry: Deleting /store/data/runC/0000/emtpy/dir' in line: deletion_lines += 1 self.assertEqual(deletion_lines, 1)
def test_nomore(self): site = picker.pick_site() main.main(site) unmerged = history.unmerged_files(site) self.assertFalse('/store/logs/prod/recent/test.tar.gz' in unmerged) self.assertFalse('/store/logs/prod/nope/test.tar.gz' in unmerged)
def test_noentry(self): os.environ['ListAge'] = '5' os.environ['InventoryAge'] = '5' main.main(picker.pick_site()) self.assertFalse(self.entry())
def test_regular(self): main.main(picker.pick_site()) self.assertTrue(self.entry())
def do_more_setup(self): # Run the main program main.main(picker.pick_site())