def test_empty_queues(self, celery, redis, metricsmock): data = {name: 0 for name in celery.all_queues} monitor_queue_size.delay().get() for key, val in data.items(): metricsmock.assert_gauge_once("queue", value=0, tags=["queue:" + key])
def test_monitor_queue_size(self): data = {} for name in self.celery_app.all_queues: data[name] = randint(1, 10) for k, v in data.items(): self.redis_client.lpush(k, *range(v)) monitor_queue_size.delay().get() self.check_stats( gauge=[('queue', 1, v, ['queue:' + k]) for k, v in data.items()])
def test_monitor_queue_size(self, celery, redis, stats): data = { 'export_queue_internal': 3, 'export_queue_backup:abcd-ef-1234': 7, } for name in celery.all_queues: data[name] = randint(1, 10) for k, v in data.items(): redis.lpush(k, *range(v)) monitor_queue_size.delay().get() stats.check( gauge=[('queue', 1, v, ['queue:' + k]) for k, v in data.items()])
def test_monitor_queue_size(self): data = { 'export_queue_internal': 3, 'export_queue_backup:abcd-ef-1234': 7, } for name in self.celery_app.all_queues: data[name] = randint(1, 10) for k, v in data.items(): self.redis_client.lpush(k, *range(v)) monitor_queue_size.delay().get() self.check_stats( gauge=[('queue', 1, v, ['queue:' + k]) for k, v in data.items()])
def test_nonempty(self, celery, redis, metricsmock): data = { "export_queue_internal": 3, "export_queue_backup:abcd-ef-1234": 7 } for name in celery.all_queues: data[name] = random.randint(1, 10) for key, val in data.items(): redis.lpush(key, *range(val)) monitor_queue_size.delay().get() for key, val in data.items(): metricsmock.assert_gauge_once("queue", value=val, tags=["queue:" + key])
def test_monitor_queue_size(self): data = {} for name in self.celery_app.all_queues: data[name] = randint(1, 10) for k, v in data.items(): self.redis_client.lpush(k, *range(v)) result = monitor_queue_size.delay().get() self.check_stats(gauge=[('queue', 1, v, ['queue:' + k]) for k, v in data.items()], ) self.assertEqual(result, data)