mirror of https://github.com/status-im/cabot.git
Add another cleanup test and fix celery test broker
Turns out celery doesn't like in-memory sql backends, but has a built-in memory broker. Use that instead and remove sqlalchemy requirement
This commit is contained in:
parent
9388274b84
commit
30df15d19a
|
@ -990,6 +990,22 @@ class TestCleanUpTask(LocalTestCase):
|
|||
tasks.clean_db(batch_size=1)
|
||||
self.assertEqual(StatusCheckResult.objects.all().count(), initial_results)
|
||||
|
||||
def test_cleanup_single_batch(self):
|
||||
with self.settings(CELERY_ALWAYS_EAGER=False):
|
||||
initial_results = StatusCheckResult.objects.all().count()
|
||||
|
||||
for i in range(2):
|
||||
StatusCheckResult(
|
||||
status_check=self.graphite_check,
|
||||
time=timezone.now() - timedelta(days=61),
|
||||
time_complete=timezone.now() - timedelta(days=61),
|
||||
succeeded=False
|
||||
).save()
|
||||
|
||||
self.assertEqual(StatusCheckResult.objects.all().count(), initial_results + 2)
|
||||
tasks.clean_db(batch_size=1)
|
||||
self.assertEqual(StatusCheckResult.objects.all().count(), initial_results + 1)
|
||||
|
||||
|
||||
class TestMinimizeTargets(LocalTestCase):
|
||||
def test_null(self):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
DATABASE_URL=sqlite://:memory:
|
||||
|
||||
CELERY_BROKER_URL=sqla+sqlite://:memory:
|
||||
CELERY_BROKER_URL=memory://
|
||||
CELERY_RESULT_BACKEND=db+sqlite://:memory:
|
||||
CELERY_ALWAYS_EAGER=true
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
coverage==4.2
|
||||
django_coverage_plugin==1.3.1
|
||||
mock==1.0.1
|
||||
sqlalchemy==1.1.5
|
||||
ipdb
|
||||
|
|
Loading…
Reference in New Issue