Esempio n. 1
0
def test_job_capacity_and_with_inactive_node():
    i = Instance.objects.create(hostname='test-1')
    i.refresh_capacity()
    assert i.capacity == 62
    i.enabled = False
    i.save()
    with override_settings(CLUSTER_HOST_ID=i.hostname):
        cluster_node_heartbeat()
        i = Instance.objects.get(id=i.id)
        assert i.capacity == 0
Esempio n. 2
0
def test_job_capacity_and_with_inactive_node():
    i = Instance.objects.create(hostname='test-1')
    with mock.patch.object(redis.client.Redis, 'ping', lambda self: True):
        i.refresh_capacity()
    assert i.capacity == 62
    i.enabled = False
    i.save()
    with override_settings(CLUSTER_HOST_ID=i.hostname):
        cluster_node_heartbeat()
        i = Instance.objects.get(id=i.id)
        assert i.capacity == 0