mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 21:58:11 +08:00
use both pid and cluster_id
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
import uuid
|
||||
|
||||
from django_q.tasks import async_task
|
||||
from django_q.brokers import get_broker
|
||||
@@ -10,7 +11,8 @@ from django_q.conf import Conf
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_monitor(monkeypatch):
|
||||
assert Stat.get(0).sentinel == 0
|
||||
cluster_id = uuid.uuid4()
|
||||
assert Stat.get(pid=0, cluster_id=4).sentinel == 0
|
||||
c = Cluster()
|
||||
c.start()
|
||||
stats = monitor(run_once=True)
|
||||
@@ -18,7 +20,7 @@ def test_monitor(monkeypatch):
|
||||
assert len(stats) > 0
|
||||
found_c = False
|
||||
for stat in stats:
|
||||
if stat.cluster_id == c.pid:
|
||||
if stat.cluster_id == c.cluster_id:
|
||||
found_c = True
|
||||
assert stat.uptime() > 0
|
||||
assert stat.empty_queues() is True
|
||||
|
||||
Reference in New Issue
Block a user