Ejemplo n.º 1
0
    def testUncollectable(self):
        # make some fake garbage
        self.patch(gc, "garbage", [1, 2])

        clock = task.Clock()
        metrics.periodicCheck(_reactor=clock)
        clock.pump([0.1, 0.1, 0.1])

        # We should have 0 reactor delay since we're using a fake clock
        report = self.observer.asDict()
        self.assertEquals(report["timers"]["reactorDelay"], 0)
        self.assertEquals(report["counters"]["gc.garbage"], 2)
        self.assertEquals(report["alarms"]["gc.garbage"][0], "WARN")
Ejemplo n.º 2
0
    def testUncollectable(self):
        # make some fake garbage
        self.patch(gc, 'garbage', [1, 2])

        clock = task.Clock()
        metrics.periodicCheck(_reactor=clock)
        clock.pump([0.1, 0.1, 0.1])

        # We should have 0 reactor delay since we're using a fake clock
        report = self.observer.asDict()
        self.assertEquals(report['timers']['reactorDelay'], 0)
        self.assertEquals(report['counters']['gc.garbage'], 2)
        self.assertEquals(report['alarms']['gc.garbage'][0], 'WARN')
Ejemplo n.º 3
0
    def testUncollectable(self):
        # make some fake garbage
        self.patch(gc, 'garbage', [1, 2])

        clock = task.Clock()
        metrics.periodicCheck(_reactor=clock)
        clock.pump([0.1, 0.1, 0.1])

        # We should have 0 reactor delay since we're using a fake clock
        report = self.observer.asDict()
        self.assertEqual(report['timers']['reactorDelay'], 0)
        self.assertEqual(report['counters']['gc.garbage'], 2)
        self.assertEqual(report['alarms']['gc.garbage'][0], 'WARN')
Ejemplo n.º 4
0
    def testPeriodicCheck(self):
        # fake out that there's no garbage (since we can't rely on Python
        # not having any garbage while running tests)
        self.patch(gc, "garbage", [])

        clock = task.Clock()
        metrics.periodicCheck(_reactor=clock)
        clock.pump([0.1, 0.1, 0.1])

        # We should have 0 reactor delay since we're using a fake clock
        report = self.observer.asDict()
        self.assertEquals(report["timers"]["reactorDelay"], 0)
        self.assertEquals(report["counters"]["gc.garbage"], 0)
        self.assertEquals(report["alarms"]["gc.garbage"][0], "OK")
Ejemplo n.º 5
0
    def testPeriodicCheck(self):
        # fake out that there's no garbage (since we can't rely on Python
        # not having any garbage while running tests)
        self.patch(gc, 'garbage', [])

        clock = task.Clock()
        metrics.periodicCheck(_reactor=clock)
        clock.pump([0.1, 0.1, 0.1])

        # We should have 0 reactor delay since we're using a fake clock
        report = self.observer.asDict()
        self.assertEquals(report['timers']['reactorDelay'], 0)
        self.assertEquals(report['counters']['gc.garbage'], 0)
        self.assertEquals(report['alarms']['gc.garbage'][0], 'OK')