simple test for monitor

This commit is contained in:
Ilan Steemers
2015-06-25 13:29:06 +02:00
parent 99a44dda45
commit 6314742343
2 changed files with 7 additions and 10 deletions
+1 -9
View File
@@ -12,16 +12,8 @@ from django_q.core import Stat, RUNNING, STOPPED
class Command(BaseCommand):
help = "Monitors cluster activity"
def add_arguments(self, parser):
parser.add_argument('--run-once',
action='store_true',
dest='run_once',
default=False,
help='Run once till first stat')
def handle(self, *args, **options):
monitor(run_once=options['run_once'])
monitor()
def monitor(run_once=False):
term = Terminal()
+6 -1
View File
@@ -8,4 +8,9 @@ def test_monitor():
stats = monitor(run_once=True)
c.stop()
assert len(stats) > 0
assert stats[0].cluster_id == c.pid
found_c = False
for stat in stats:
if stat.cluster_id == c.pid:
found_c = True
break
assert found_c is True