Fix bug that would run --worker-info health checks on control or hybrid nodes (#11161)

* Fix bug that would run health check on control nodes

* Prevent running execution node health check against main cluster nodes
This commit is contained in:
Alan Rominger
2021-09-29 09:34:22 -04:00
committed by GitHub
parent b9ecf389c2
commit 7c9626b0e7
2 changed files with 15 additions and 3 deletions
+11 -2
View File
@@ -2,8 +2,8 @@ import pytest
from unittest import mock
import os
from awx.main.tasks import RunProjectUpdate, RunInventoryUpdate
from awx.main.models import ProjectUpdate, InventoryUpdate, InventorySource
from awx.main.tasks import RunProjectUpdate, RunInventoryUpdate, execution_node_health_check
from awx.main.models import ProjectUpdate, InventoryUpdate, InventorySource, Instance
@pytest.fixture
@@ -15,6 +15,15 @@ def scm_revision_file(tmpdir_factory):
return os.path.join(revision_file.dirname, 'revision.txt')
@pytest.mark.django_db
@pytest.mark.parametrize('node_type', ('control', 'hybrid'))
def test_no_worker_info_on_AWX_nodes(node_type):
hostname = 'us-south-3-compute.invalid'
Instance.objects.create(hostname=hostname, node_type=node_type)
with pytest.raises(RuntimeError):
execution_node_health_check(hostname)
@pytest.mark.django_db
class TestDependentInventoryUpdate:
def test_dependent_inventory_updates_is_called(self, scm_inventory_source, scm_revision_file):