mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
Assert isolated nodes have capacity set to 0 and restored based on version
This commit is contained in:
committed by
Matthew Jones
parent
692007072d
commit
96fd07d0f3
@@ -117,6 +117,28 @@ class TestIsolatedManagementTask:
|
|||||||
inst.save()
|
inst.save()
|
||||||
return inst
|
return inst
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def old_version(self, control_group):
|
||||||
|
ig = InstanceGroup.objects.create(name='thepentagon', controller=control_group)
|
||||||
|
inst = ig.instances.create(hostname='isolated-old', capacity=103)
|
||||||
|
inst.save()
|
||||||
|
return inst
|
||||||
|
|
||||||
|
def test_old_version(self, control_instance, old_version):
|
||||||
|
update_capacity = isolated_manager.IsolatedManager.update_capacity
|
||||||
|
|
||||||
|
assert old_version.capacity == 103
|
||||||
|
with mock.patch('awx.main.tasks.settings', MockSettings()):
|
||||||
|
# Isolated node is reporting an older version than the cluster
|
||||||
|
# instance that issued the health check, set capacity to zero.
|
||||||
|
update_capacity(old_version, {'version': '1.0.0'}, '3.0.0')
|
||||||
|
assert old_version.capacity == 0
|
||||||
|
|
||||||
|
# Upgrade was completed, health check playbook now reports matching
|
||||||
|
# version, make sure capacity is set.
|
||||||
|
update_capacity(old_version, {'version': '5.0.0-things', 'capacity':103}, '5.0.0-stuff')
|
||||||
|
assert old_version.capacity == 103
|
||||||
|
|
||||||
def test_takes_action(self, control_instance, needs_updating):
|
def test_takes_action(self, control_instance, needs_updating):
|
||||||
original_isolated_instance = needs_updating.instances.all().first()
|
original_isolated_instance = needs_updating.instances.all().first()
|
||||||
with mock.patch('awx.main.tasks.settings', MockSettings()):
|
with mock.patch('awx.main.tasks.settings', MockSettings()):
|
||||||
|
|||||||
Reference in New Issue
Block a user