Exemple #1
0
    def test_simple(self):
        cleanup(days=1)

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #2
0
    def test_simple(self):
        cleanup(days=1)

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #3
0
    def handle(self, **options):
        import logging
        from sentry.tasks.cleanup import cleanup

        if options['verbosity'] > 1:
            logger = cleanup.get_logger()
            logger.setLevel(logging.DEBUG)
            logger.addHandler(logging.StreamHandler())

        cleanup(days=options['days'], project=options['project'])
Exemple #4
0
    def handle(self, **options):
        import logging
        from sentry.tasks.cleanup import cleanup

        if options['verbosity'] > 1:
            logger = cleanup.get_logger()
            logger.setLevel(logging.DEBUG)
            logger.addHandler(logging.StreamHandler())

        cleanup(days=options['days'], project=options['project'])
Exemple #5
0
    def handle(self, **options):
        import logging
        from sentry.tasks.cleanup import cleanup

        level = options['level']

        if level is not None and not str(level).isdigit():
            options['level'] = getattr(logging, level.upper())

        cleanup(days=options['days'], logger=options['logger'], site=options['site'], server=options['server'],
                level=options['level'], project=options['project'], resolved=options['resolved'])
Exemple #6
0
    def test_level(self):
        cleanup(days=1, level=logging.ERROR)

        self.assertEquals(Event.objects.count(), 1)
        for message in Event.objects.all():
            self.assertNotEquals(message.level, logging.ERROR)
        self.assertEquals(Group.objects.count(), 1)

        cleanup(days=1, level=logging.DEBUG)

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #7
0
    def test_server_name(self):
        cleanup(days=1, server='dcramer.local')

        self.assertEquals(Event.objects.count(), 2)
        for message in Event.objects.all():
            self.assertNotEquals(message.server_name, 'dcramer.local')
        self.assertEquals(Group.objects.count(), 1)

        cleanup(days=1, server='node.local')

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #8
0
    def test_project(self):
        orig_counts = {}
        for model in ALL_MODELS:
            orig_counts[model] = model.objects.count()

        cleanup(days=1, project=2)

        for model in ALL_MODELS:
            assert model.objects.count() == orig_counts[model]

        cleanup(days=1, project=1)

        for model in ALL_MODELS:
            assert model.objects.count() == 0
Exemple #9
0
    def test_level(self):
        cleanup(days=1, level=logging.ERROR)

        self.assertEquals(Event.objects.count(), 1)
        for message in Event.objects.all():
            self.assertNotEquals(message.level, logging.ERROR)
        self.assertEquals(Group.objects.count(), 1)

        cleanup(days=1, level=logging.DEBUG)

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #10
0
    def test_server_name(self):
        cleanup(days=1, server='dcramer.local')

        self.assertEquals(Event.objects.count(), 2)
        for message in Event.objects.all():
            self.assertNotEquals(message.server_name, 'dcramer.local')
        self.assertEquals(Group.objects.count(), 1)

        cleanup(days=1, server='node.local')

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #11
0
    def test_project(self):
        orig_counts = {}
        for model in ALL_MODELS:
            orig_counts[model] = model.objects.count()

        cleanup(days=1, project=2)

        for model in ALL_MODELS:
            assert model.objects.count() == orig_counts[model]

        cleanup(days=1, project=1)

        for model in ALL_MODELS:
            assert model.objects.count() == 0
Exemple #12
0
    def handle(self, **options):
        import logging
        from sentry.tasks.cleanup import cleanup

        level = options['level']

        if level is not None and not str(level).isdigit():
            options['level'] = getattr(logging, level.upper())

        cleanup(days=options['days'],
                logger=options['logger'],
                site=options['site'],
                server=options['server'],
                level=options['level'],
                project=options['project'],
                resolved=options['resolved'])
Exemple #13
0
    def test_logger(self):
        cleanup(days=1, logger='sentry')

        self.assertEquals(Event.objects.count(), 8)
        for message in Event.objects.all():
            self.assertNotEquals(message.logger, 'sentry')
        self.assertEquals(Group.objects.count(), 3)
        for message in Group.objects.all():
            self.assertNotEquals(message.logger, 'sentry')

        cleanup(days=1, logger='awesome')

        self.assertEquals(Event.objects.count(), 4)
        for message in Event.objects.all():
            self.assertNotEquals(message.logger, 'awesome')
        self.assertEquals(Group.objects.count(), 2)
        for message in Group.objects.all():
            self.assertNotEquals(message.logger, 'awesome')

        cleanup(days=1, logger='root')

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #14
0
    def test_logger(self):
        cleanup(days=1, logger='sentry')

        self.assertEquals(Event.objects.count(), 8)
        for message in Event.objects.all():
            self.assertNotEquals(message.logger, 'sentry')
        self.assertEquals(Group.objects.count(), 3)
        for message in Group.objects.all():
            self.assertNotEquals(message.logger, 'sentry')

        cleanup(days=1, logger='awesome')

        self.assertEquals(Event.objects.count(), 4)
        for message in Event.objects.all():
            self.assertNotEquals(message.logger, 'awesome')
        self.assertEquals(Group.objects.count(), 2)
        for message in Group.objects.all():
            self.assertNotEquals(message.logger, 'awesome')

        cleanup(days=1, logger='root')

        self.assertEquals(Event.objects.count(), 0)
        self.assertEquals(Group.objects.count(), 0)
        self.assertEquals(MessageCountByMinute.objects.count(), 0)
        self.assertEquals(MessageFilterValue.objects.count(), 0)
Exemple #15
0
    def test_simple(self):
        cleanup(days=1)

        for model in ALL_MODELS:
            assert model.objects.count() == 0
Exemple #16
0
    def test_simple(self):
        cleanup(days=1)

        for model in ALL_MODELS:
            assert model.objects.count() == 0