Пример #1
0
    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())
Пример #2
0
 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)
Пример #3
0
    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)
Пример #4
0
    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'])
Пример #5
0
    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))
Пример #6
0
    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'
        ])
Пример #7
0
    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)
Пример #8
0
    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)
Пример #9
0
 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)
Пример #10
0
    def test_noentry(self):
        os.environ['ListAge'] = '5'
        os.environ['InventoryAge'] = '5'

        main.main(picker.pick_site())
        self.assertFalse(self.entry())
Пример #11
0
 def test_regular(self):
     main.main(picker.pick_site())
     self.assertTrue(self.entry())
Пример #12
0
 def do_more_setup(self):
     # Run the main program
     main.main(picker.pick_site())