mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-29 03:11:48 -05:00
Support expiring of capacity if a node is down
For a certain amount of time
This commit is contained in:
@@ -153,7 +153,7 @@ def user_project(user):
|
||||
|
||||
@pytest.fixture
|
||||
def instance(settings):
|
||||
return Instance.objects.create(uuid=settings.SYSTEM_UUID, hostname="instance.example.org")
|
||||
return Instance.objects.create(uuid=settings.SYSTEM_UUID, hostname="instance.example.org", capacity=100)
|
||||
|
||||
@pytest.fixture
|
||||
def organization(instance):
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
from awx.main.models import Job
|
||||
from awx.main.models import Job, Instance
|
||||
|
||||
from django.utils import timezone
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from datetime import timedelta
|
||||
import pytest
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -9,3 +14,12 @@ def test_orphan_unified_job_creation(instance, inventory):
|
||||
assert job2.job_template is None
|
||||
assert job2.inventory == inventory
|
||||
assert job2.name == 'hi world'
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_job_capacity_and_with_inactive_node():
|
||||
i = Instance.objects.create(hostname='test-1', capacity=50)
|
||||
assert Instance.objects.total_capacity() == 50
|
||||
i2 = Instance.objects.create(hostname='test-2', capacity=50)
|
||||
assert Instance.objects.total_capacity() == 100
|
||||
with override_settings(AWX_ACTIVE_NODE_TIME=0):
|
||||
assert Instance.objects.total_capacity() < 100
|
||||
|
||||
Reference in New Issue
Block a user